Top 25 most asked
The problems that come up again and again in screens and onsites, across all five languages.
- Two Sum Find the indices of the two numbers that add up to a target.
- Valid Parentheses Check that brackets are balanced and properly nested.
- Best Time to Buy and Sell Stock Max profit from one buy and one later sell.
- Group Anagrams Group words that are anagrams of each other.
- Top K Frequent Elements Return the k most frequent values.
- Longest Substring Without Repeating Characters Length of the longest substring with all-distinct characters.
- 3Sum All unique triplets that sum to zero.
- Reverse Linked List Reverse a singly linked list.
- Merge Two Sorted Lists Merge two sorted linked lists into one sorted list.
- Binary Tree Level Order Traversal Values of a binary tree, level by level (BFS).
- Validate Binary Search Tree Check the BST property across the whole tree.
- Number of Islands Count connected groups of land cells in a grid.
- Kth Largest Element in an Array The k-th largest value without fully sorting.
- Merge Intervals Merge all overlapping intervals.
- Climbing Stairs Ways to climb n stairs taking 1 or 2 steps at a time.
- Coin Change Fewest coins that make up an amount.
- Search in Rotated Sorted Array Binary search in a sorted array that was rotated.
- LRU Cache A fixed-capacity cache that evicts the least recently used key, with O(1) get and put.
- Retry with Exponential Backoff Retry a failing operation with exponential delays, but never retry non-retryable errors.
- Product of Array Except Self Product of all other elements for each index, without division.
- Contains Duplicate Return true if any value appears at least twice.
- Min Stack A stack that returns its minimum in O(1).
- Linked List Cycle Detect whether a linked list has a cycle (Floyd's algorithm).
- Course Schedule Can all courses be finished given prerequisites? (cycle detection)
- Token Bucket Rate Limiter Allow bursts up to a capacity while refilling at a steady rate.