- Interview Questions
- /
- Problems
Most-asked coding interview problems
The 50 problems tagged by the most companies in our interview dataset. Each page lets you write and test a solution in Python or JavaScript in your browser, then walks through the approach from brute force to optimal.
| Problem | Pattern | Difficulty | Companies |
|---|---|---|---|
| Two Sum | Hash map of complements | Easy | 196 |
| LRU Cache | Hash map + doubly linked list | Medium | 196 |
| Number of Islands | Flood fill (DFS/BFS on a grid) | Medium | 189 |
| Merge Intervals | Sort, then sweep | Medium | 183 |
| Valid Parentheses | Stack of open brackets | Easy | 180 |
| Longest Palindromic Substring | Expand around center | Medium | 166 |
| Longest Substring Without Repeating Characters | Sliding window with last-seen index | Medium | 165 |
| Best Time to Buy and Sell Stock | Running minimum | Easy | 163 |
| Trapping Rain Water | Two pointers with running maximums | Hard | 161 |
| Group Anagrams | Hash map keyed by a canonical form | Medium | 156 |
| Container With Most Water | Two pointers from both ends | Medium | 153 |
| Maximum Subarray | Kadane's algorithm | Medium | 149 |
| Search in Rotated Sorted Array | Binary search on the sorted half | Medium | 149 |
| Spiral Matrix | Shrinking boundaries | Medium | 143 |
| Rotting Oranges | Multi-source BFS | Medium | 142 |
| String Compression | Read and write pointers | Medium | 140 |
| Valid Palindrome | Two pointers from both ends | Easy | 137 |
| Merge k Sorted Lists | Min-heap of list heads | Hard | 135 |
| Top K Frequent Elements | Count, then bucket by frequency | Medium | 135 |
| Product of Array Except Self | Prefix and suffix products | Medium | 133 |
| Rotate Image | Transpose, then reverse each row | Medium | 133 |
| Roman to Integer | Compare each symbol with the next | Easy | 133 |
| Course Schedule | Topological sort (Kahn’s algorithm) | Medium | 132 |
| Decode String | Stack for nested structure | Medium | 132 |
| Sliding Window Maximum | Monotonic deque | Hard | 131 |
| Climbing Stairs | 1D dynamic programming | Easy | 130 |
| Merge Sorted Array | Two pointers from the back | Easy | 129 |
| 3Sum | Sort + two pointers | Medium | 128 |
| Median of Two Sorted Arrays | Binary search on a partition | Hard | 127 |
| Basic Calculator II | Running term with deferred addition | Medium | 127 |
| Longest Consecutive Sequence | Hash set, count from run starts | Medium | 126 |
| Word Ladder | Breadth-first search on an implicit graph | Hard | 126 |
| Next Permutation | Rightmost ascent, swap, reverse | Medium | 126 |
| Add Two Numbers | Digit-by-digit addition with a carry | Medium | 125 |
| Longest Common Prefix | Vertical scan | Easy | 124 |
| Letter Combinations of a Phone Number | Backtracking over choices | Medium | 124 |
| Subarray Sum Equals K | Prefix sums + hash map of counts | Medium | 123 |
| Generate Parentheses | Backtracking with constraints | Medium | 123 |
| Coin Change | Bottom-up DP over amounts | Medium | 123 |
| Gas Station | Greedy restart on deficit | Medium | 123 |
| Kth Largest Element in an Array | Quickselect | Medium | 122 |
| Minimum Window Substring | Variable-size sliding window with counts | Hard | 120 |
| Min Stack | Stack with running minimum | Medium | 120 |
| Palindrome Number | Reverse half the digits | Easy | 118 |
| House Robber | 1D dynamic programming | Medium | 118 |
| Basic Calculator | Running sum with a stack of saved contexts | Hard | 118 |
| Word Search | Grid backtracking (DFS) | Medium | 117 |
| Subsets II | Backtracking with duplicate skipping | Medium | 117 |
| Move Zeroes | Read/write two pointers | Easy | 116 |
| All Nodes Distance K in Binary Tree | Tree to graph + BFS | Medium | 116 |
Get live help in the real interview
Working solutions in real time during your actual interview. Invisible to screensharing.
Start Free TrialNo credit card required