Curation of great Leetcode questions, categorized by topic/concept. My criteria for curation is that questions must be valuable, and not just difficult for the sake of being difficult.
Valuable questions can usually be solved in a variety of ways with different time/space efficiencies (through the use of various data structures), or require the application of certain common and reusable techniques.
Bad questions are those that are extremely difficult for the sake of being so, and require knowledge of some uncommon technique to solve (which cannot be applied outside a very narrow scope).
Essentially, this is a curation of questions that I personally use to prepare for technical interviews.
Sign up with Triplebyte for free to interview once and apply for multiple top tech companies!
- Maximum subarray (easy)
- Merge sorted array (easy)
- Reverse string (easy)
- 3sum (medium)
- Decode string (medium)
- Find first and last position of element in sorted array (medium)
- Find K pairs with smallest sums (medium)
- Kth largest element in an array (medium)
- Longest increasing subsequence (medium)
- Maximum product subarray (medium)
- Minimum number of steps to make two strings anagram (medium)
- Palindromic substrings (medium)
- Product of array except self (medium)
- Search in rotated sorted array (medium)
- Sort colors (medium)
- Subarray sum equals k (medium)
- Best time to buy and sell stock III (hard)
- Count of range sum (hard)
- Count of smaller numbers after self (hard)
- Course schedule III (hard)
- Longest consecutive sequence (hard)
- Merge k sorted lists (hard)
- Sliding window maximum (hard)
- Sliding window median (hard)
- Split array largest sum (hard)
- Trapping rain water (hard)
- Container with most water (medium)
- Longest mountain in array (medium)
- Longest substring without repeating characters (medium)
- Minimum size subarray sum (medium)
- Permutation in string (medium)
- Minimum window substring (hard)
- Merge intervals (medium)
- Non-overlapping intervals (medium)
- Insert interval (hard)
- Maximize sum of array after K negations (easy)
- Find K pairs with smallest sums (medium)
- Kth largest element in an array (medium)
- Task scheduler (medium)
- Find median from data stream (hard)
- Intersection of two linked lists (easy)
- Linked list cycle (easy)
- Merge two sorted lists (easy)
- Palindrome linked list (easy)
- Remove duplicates from sorted list (easy)
- Reverse linked list (easy)
- Odd even linked list (medium)
- Reverse linked list II (medium)
- Rotate list (medium)
- Merge k sorted lists (hard)
- Balanced binary tree (easy)
- Convert sorted array to binary search tree (easy)
- Invert binary tree (easy)
- Merge two binary trees (easy)
- Range sum of BST (easy)
- Symmetric tree (easy)
- All nodes distance K in binary tree (medium)
- Binary tree inorder traversal (medium)
- Binary tree level order traversal (medium)
- Binary tree zigzag level order traversal (medium)
- Binary tree right side view (medium)
- Construct binary tree from inorder and postorder traversal (medium)
- Construct binary tree from preorder and inorder traversal (medium)
- Construct binary tree from preorder and postorder traversal (medium)
- Flatten binary tree to linked list (medium)
- Kth smallest element in a BST (medium)
- Lowest common ancestor of a binary tree (medium)
- Maximum binary tree (medium)
- Maximum level sum of a binary tree (medium)
- Sum root to leaf numbers (medium)
- Unique binary search trees (medium)
- Validate binary search tree (medium)
- Binary tree maximum path sum (hard)
- Flood fill (easy)
- Accounts merge (medium)
- Cheapest flights within k stops (medium)
- Course schedule (medium)
- Course schedule II (medium)
- Graph valid tree (medium)
- Pacific atlantic water flow (medium)
- Redundant connection (medium)
- Word ladder (medium)
- Word search (medium)
- Combination Sum (medium)
- Decode ways (medium)
- Permutations (medium)
- Permutations II (permutations with repetitions) (medium)
- Subsets (medium)
- Interleaving string (hard)
- Remove invalid parentheses (hard)
- Climbing stairs (easy)
- Decode ways (medium)
- Jump game (medium)
- Longest increasing subsequence (medium)
- Minimum path sum (medium)
- Unique paths (medium)
- Best time to buy and sell stock III (hard)
- Interleaving string (hard)
- Jump game II (hard)
- Edit distance (hard)
- Wildcard matching (hard)
- Implement queue using stacks (easy)
- Min stack (easy)
- Binary search tree iterator (medium) (implementation should be lazy)
- Flatten nested list iterator (medium) (implementation should be lazy)
- Implement trie (prefix tree) (medium)
- LRU cache (medium)
- Longest Palindrome (easy)
- Minimum Cost to Move Chips to The Same Position (easy)
- Balance a Binary Search Tree (medium)
- Bulb Switcher IV (medium)
- Candy (hard)
- Couples holding hands (hard)