Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Convert Binary Number in a Linked List to Integer
- Insertion Sort List
- Consecutive Characters
- Minimum Height Trees
- Minimum Cost to Move Chips to The Same Position
- Find the Smallest Divisor Given a Threshold
- Add Two Numbers II
- Binary Tree Tilt
- Maximum Difference Between Node and Ancestor
- Flipping an Image
- Valid Square
- Permutations II
- Populating Next Right Pointers in Each Node
- Poor Pigs
- Range Sum of BST
- Longest Mountain in Array
- Mirror Reflection
- Merge Intervals
- Decode String
- Search in Rotated Sorted Array II
- Numbers At Most N Given Digit Set
- Unique Morse Code Words
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Number of Recent Calls : Queue
- Combination Sum
- K-diff Pairs in an Array
- Remove Covered Intervals
- Complement of Base 10 Integer
- Insert into a Binary Search Tree
- Rotate List
- Binary Search
- Serialize and Deserialize BST
- Minimum Number of Arrows to Burst Balloons
- Remove Duplicate Letters
- Buddy Strings
- Sort List
- House Robber II
- Rotate Array
- Search a 2D Matrix
- Repeated DNA Sequences
- Best Time to Buy and Sell Stock IV
- Minimum Domino Rotations For Equal Row
- Clone Graph
- Asteroid Collision
- Minimum Depth of Binary Tree
- 132 Pattern
- Bag of Tokens
- Stone Game IV
- Champagne Tower
- Linked List Cycle II
- Summary Ranges
- Maximum Distance to Closest Person
- Number of Longest Increasing Subsequence
- Recover Binary Search Tree
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Largest Time for Given Digits
- Contains Duplicate III
- Repeated Substring Pattern
- Partition Labels
- All Elements in Two Binary Search Trees
- Image Overlap
- Word Pattern
- Sum of Root To Leaf Binary Numbers
- Compare Version Numbers
- Bulls and Cows
- Maximum Product Subarray
- Combination Sum III
- Insert Interval
- House Robber
- Length of Last Word
- Maximum XOR of Two Numbers in an Array
- Robot Bounded In Circle
- Best Time to Buy and Sell Stock
- Sequential Digits
- Gas Station
- Subarray Product Less Than K
- First Missing Positive
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Detect Capital
- Design HashSet
- Valid Palindrome
- Power of Four
- Add and Search Word Data structure design
- Find All Duplicates in an Array
- Vertical Order Traversal of a Binary Tree
- Path Sum III
- Rotting Oranges
- Excel Sheet Column Number
- H-Index
- Pascal's Triangle II
- Iterator for Combination
- Longest Palindrome
- Non-overlapping Intervals
- Best Time to Buy and Sell Stock III
- Distribute Candies to People
- Numbers With Same Consecutive Differences
- Goat Latin
- Reorder List
- Sort Array By Parity
- Random Point in Non-overlapping Rectangles
- Stream of Characters
- Sum of Left Leaves
- Minimum Cost For Tickets
- Fizz Buzz
- Find Right Interval
- Implement Rand10() Using Rand7()
- Pancake Sorting
- Largest Component Size by Common Factor
- Delete Node in a BST
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Arranging Coins: Maths
- Binary Tree Level Order Traversal II: DFS
- Prison Cells After N Days: Maths
- Ugly Number II: DP
- Hamming Distance: Bitwise Manipulation
- Plus One: Maths
- Island Perimeter: BFS
- 3Sum: Two pointers
- Maximum Width of Binary Tree: DFS
- Flatten a Multilevel Doubly Linked List: Queue
- Subsets: DP
- Reverse Bits: Bitwise
- Same Tree: DFS
- Angle Between Hands of a Clock: Math
- Reverse Words in a String: Pointer
- Pow(x,n): Recursion
- Top K Frequent Elements: Bucket
- Course Schedule II: BFS
- Add Binary
- Remove Linked List Elements
- Word Search
- Binary Tree Zigzag Level Order Traversal
- Single Number III
- All Paths From Source to Target
- Find Minimum in Rotated Sorted Array II
- Add Digits
- Construct Binary Tree from Inorder and Postorder Traversal
- Task Scheduler
- Best Time to Buy and Sell Stock with Cooldown: State machine
- Word Break II
- Climbing Stairs: DP
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- Invert Binary Tree: Tree Traversal
- Delete Node in a Linked List: Linked List
- Two City Scheduling: DP
- Reverse String: String
- Random Pick With Weight: Binary Search + Probability
- Queue Reconstruction by Height: Greedy
- Coin Change 2: DP
- Power of Two: Bitwise manipulation
- Is Subsequence: Two pointers / DP
- Search Insert Position: Binary Search
- Sort Colors: Two Pointers
- Insert Delete GetRandom: Hash Table
- Largest Divisible Subset: DP
- Cheapest Flights Within K Stops: DP
- Search in a Binary Search Tree: Recursive
- Validate IP Address: String
- Surrounded Regions: BFS
- H Index II: Binary Search
- Longest Duplicate Substring:
- Permutation Sequence: Maths
- Dungeon Game: DP
- Single Number II: Bitwise Manipulation
- Count Complete Tree Nodes: Tree Traversal
- Unique Binary Search Trees: DP
- Find the Duplicate Number: Cycle Detect
- Sum Root To Leaf Numbers: DFS
- Perfect Squares: DP
- Reconstruct Itinerary: DFS
- Unique Paths: DP
- Word Search: Trie + DFS
Click here for problem descriptions.
Solutions in various programming languages are provided. Enjoy it.
- First Bad String: Binary search.
- Jewels and Stones: Hash Table
- Ransom Note: Hash Table
- Number Complement: Bitwise Manipulation
- First Unique Character In a String: Hash Table
- Majority Element: Ad hoc
- Cousins in Binary Tree: BFS / Recursion
- Check if it is straight line: Cross Product
- Valid Perfect Square: Math
- Find the Town Judge: Graph Theory
- Flood Fill: BFS
- Single Element In a Sorted Array: Binary Search
- Remove K Digits: Greedy
- Implement Trie: Trie
- Maximum Sum Circular Subarray: DP
- Odd Even Linked List: Linked List
- Find All Anagrams in a String: Sliding window + Hash Table
- Permutation In String: Sliding window + Hash Table
- Online Stock Span: DP
- Kth-Smallest-Element-In-A-BST: BST
- Count Square Submatrices with All Ones: DP
- Sort Characters By Frequency: Hash Table
- Interval List Intersections: Two Pointers
- Construct Binary Search Tree from Preorder Traversal: Binary Search Tree
- Uncrossed Lines: DP
- Contiguous Array: Hash Table
- Possible Bipartition: Bipartite Graph
- Counting Bits: Math
- Course Schedule: Topological Sort
- K Closest Points to Origin: Priority_queue, Sort
- Edit Distance: DP
Click here for problem descriptions.
- Single Number: Bitwise Manipulation
- Happy Number: Implementation
- Maximum Subarray: DP
- Move Zeros: Two pointers
- Best Time to Buy and Sell Stock II: Greedy
- Group Anagrams: Hash Table