Originally posted New Year Gift - Curated List of Top 75 LeetCode Questions to Save Your Time as a curated list of the top 75 questions to understand when preparing for a FAANGMULA+ interview.
5 weeks of LeetCode questions broken into categories: sequences, data structures, non-linear data structures, more data structures, and finally dynamic programming as organized here.
In week 1, we will warm up by doing a mix of easy and medium questions on arrays and strings. Arrays and strings are the most common types of questions to be found in interviews; gaining familiarity with them will help in building strong fundamentals to better handle tougher questions.
Question | Difficulty | NeetCode | Solution | Category | Revisit |
---|---|---|---|---|---|
Two Sum | Easy | π | TwoSummer | Arrays & Hashing | |
Contains Duplicate | Easy | π | ContainsDuplicater | Arrays & Hashing | |
Best Time to Buy and Sell Stock | Easy | π | BuySellStock | Sliding Window | |
Valid Anagram | Easy | π | Anagram | Strings | |
Valid Parentheses | Easy | π | ValidParentheses | Strings | |
Maximum Subarray | Easy | π | MaxSubArrayFinder | Sliding Window | Y |
Product of Array Except Self | Medium | π | ProductExceptSelf | Arrays & Hashing | Y |
3Sum | Medium | π | 3Summer | Arrays & Hashing | |
Merge Intervals | Medium | π | Intervals | Intervals | |
Group Anagrams | Medium | π | GroupAnagram | Strings | |
BONUS | --- | ππ» | --- | --- | --- |
Maximum Product Subarray | Medium | π | MaxSubArrayFinder | DP | YES!!! |
Search in Rotated Sorted Array | Medium | π | SearchRotatedArray | Binary Search | Y |
Two Sum II - Sorted | Medium | π | TwoSummer | Double Pointers | |
Insert Interval | Medium | π | Intervals | Intervals | Y |
The focus of week 2 is on linked lists, strings and matrix-based questions. The goal is to learn the common routines dealing with linked lists, traversing matrices and sequence analysis (arrays/strings) techniques such as sliding window, linked list traversal and matrix traversal.
Question | Difficulty | NeetCode | Solution | Category | Revisit |
---|---|---|---|---|---|
Detect Cycle in a Linked List | Easy | π€·π»ββοΈ | HasCycle | Linked Lists | |
Find Minimum in Rotated Sorted Array | Medium | π€·π»ββοΈ | SearchRotatedArray | Double Pointers | |
Container With Most Water | Medium | π | MaxArea | Double Pointers | |
Longest Repeating Character Replacement | Medium | π | CharacterReplacement | Double Pointers | |
Longest Substring Without Repeating Characters | Medium | π€·π»ββοΈ | LengthOfLongestSubstring | Double Pointers | |
Number of Islands | Medium | π€·π»ββοΈ | NumIslands | Graph | |
Remove Nth Node From End Of List | Medium | π | RemoveNthFromEnd | Linked Lists | |
Palindromic Substrings | Medium | π | CountSubstrings | Double Pointers | |
Pacific Atlantic Water Flow | Medium | π | PacificAtlantic | Graph | |
Minimum Window Substring | Hard | π | MinWindow | Sliding Window | |
BONUS | --- | ππ» | --- | --- | --- |
Find Median from Data Stream | Hard | π | MedianFinder.cs | Data Structures | |
Implement Trie (Prefix Tree) | Medium | π | Trie.cs | Data Structures |
The focus of week 3 is on non-linear data structures like trees, graphs and heaps. You should be familiar with the various tree traversal (in-order, pre-order, post-order) algorithms and graph traversal algorithms such as breadth-first search and depth-first search. In my experience, using more advanced graph algorithms (Dijkstra's and Floyd-Warshall) is quite rare and usually not necessary.
Question | Difficulty | NeetCode | Solution | Category | Revisit |
---|---|---|---|---|---|
Invert/Flip Binary Tree | Easy | π€·π»ββοΈ | InvertTree | ||
Validate Binary Search Tree | Medium | π€·π»ββοΈ | IsValidBST | ||
Non-overlapping Intervals | Medium | π€·π»ββοΈ | EraseOverlapIntervals | ||
Construct Binary Tree from Preorder and Inorder Traversal | Medium | π€·π»ββοΈ | TODO | ||
Top K Frequent Elements | Medium | π€·π»ββοΈ | TopKFrequentUsingHeap | ||
Clone Graph | Medium | π€·π»ββοΈ | CloneGraph.cs | ||
Course Schedule | Medium | π€·π»ββοΈ | CourseSchedule.cs | ||
Serialize and Deserialize Binary Tree | Hard | π€·π»ββοΈ | |||
Binary Tree Maximum Path Sum | Hard | π€·π»ββοΈ | |||
BONUS | --- | ππ» | --- | --- | --- |
Graph Valid Tree | Medium | π | ValidTree | Graph | |
Partition Equal Subset Sum | Medium | π | CanPartition | Meta |
Week 4 builds up on knowledge from previous weeks but questions are of increased difficulty. Expect to see such level of questions during interviews. You get more practice on more advanced data structures such as (but not exclusively limited to) heaps and tries which are less common but are still asked.
Week 5 focuses on Dynamic Programming (DP) questions. Personally as an interviewer, I'm not a fan of DP questions as they are not really applicable to practical scenarios and frankly if I were made to do the tough DP questions during my interviews I'd not have gotten the job. However, companies like Google still ask DP questions and if joining Google is your dream, DP is unavoidable.
DP questions can be hard to master and the best way to get better at them is... you guessed it - practice! Be familiar with the concepts of memoization and backtracking.
Practically speaking the return of investment (ROI) on studying and practicing for DP questions is very low. Hence DP questions are less important/optional and you should only do them if you have time to spare and you're very keen to have all bases covered (and interviewing with Google).
Question | Difficulty | NeetCode | Solution | Category |
---|---|---|---|---|
Climbing Stairs | Easy | π€·π»ββοΈ | ClimbStairs | DP |
Coin Change | Medium | π | CoinChange | DP |
Longest Increasing Subsequence | Medium | π€·π»ββοΈ | LengthOfLIS | DP |
Combination Sum | Medium | π€·π»ββοΈ | ||
House Robber | Medium | π | HouseRobber.cs | DP |
House Robber II | Medium | π€·π»ββοΈ | ||
Decode Ways | Medium | π€·π»ββοΈ | ||
Unique Paths | Medium | π€·π»ββοΈ | ||
Jump Game | Medium | π€·π»ββοΈ | ||
Word Break | Medium | π€·π»ββοΈ | ||
BONUS | --- | ππ» | --- | --- |
The Maze | Medium | π€·π»ββοΈ | SlidingMaze.cs | SquareUp |
LRU Cache | Medium | π€·π»ββοΈ | LRUCache | LinkList |
Random Pick with Weight | Medium | π€·π»ββοΈ | RandomPick.cs | |
Reorganize String | Medium | π | ReorganizeString | Space X |
Baseball Game | EZ | π | CalPoints | SpeedRun |
Merge k Sorted Lists | Hard | π€·π»ββοΈ | MergeKLists | Competition |
Merge Sorted Array | EZ | π | Merge | x2 ptr |
Sort List | Medium | π | SortList | MergeSort |
Buildings With an Ocean View | Med | π€·π»ββοΈ | FindBuildings | |
Sum of Subarray Ranges | EZ/Hard+ | π€·π»ββοΈ | SubArrayRanges | MonoStack |
Helping neetcode.io on code completion for csharp solutions with PR's
Question | Difficulty | NeetCode | Solution |
---|---|---|---|
Encode and Decode Strings | Med | π | Codec |
Permutation in String | Med | π | PermutationInString |
Sliding Window Maximum | Hard | π | SlidingWindowMax |
Min Stack | Med | π | MinStack |
Daily Temperatures | Med | π | DailyTemperatures |
Koko Eating Bananas | Med | π | Bananas |
Car Fleet | Med | π | CarFleet |
Permutations | Med | π | Permute |
Target Sum | Med | π | FindTargetSumWays |
Generate Parentheses | Med | β | Generate |
- What are you the worst at? DP
- What is the most challenging type of problem? DP
- What are you going to practice? DP
Question | Difficulty | Solution |
---|---|---|
70. Climbing Stairs | Easy | ClimbStairs |
746. Min Cost Climbing Stairs | Easy | MinCostClimbingStairs |
198. House Robber | Med | Robber1 |
213. House Robber II | Med | Rob |
- NeetCode website
- NeetCode YouTube
- Dynamic Programming | Alvin
- Graph Algorithms for Technical Interviews | Alvin
- Topological Sort | Kahn's Algorithm | William
- Dijkstra's Shortest Path Algorithm | William
- Union Find Introduction | William
- More DP Problems | NeetCode
- Scalability & System Design for Developers paid course
- System Design Interview on YouTube
- Medium author Kousik Nath
- 7 onsites, 7 offers from Netflix alum