Top 15 LeetCode Questions for 40+ LPA Jobs
1. Subarray Sum Equals K [Medium] (LeetCode #560)
Use prefix sum and a hashmap to count occurrences of (sum - k). Time: O(n), Space: O(n).
2. Longest Consecutive Sequence [Hard] (LeetCode #128)
Use a set and only check for sequence starts. Time: O(n), Space: O(n).
3. Minimum Window Substring [Hard] (LeetCode #76)
Use sliding window + hashmap. Expand until all chars found, then contract. Time: O(n), Space: O(1).
4. Longest Substring Without Repeating Characters [Medium] (LeetCode #3)
Use sliding window and hashset to track characters. Time: O(n), Space: O(n).
5. Merge Intervals [Medium] (LeetCode #56)
Sort intervals then merge overlapping ones. Time: O(n log n), Space: O(n).
6. Non-overlapping Intervals [Hard] (LeetCode #435)
Greedy algorithm: sort by end time, keep count of non-overlapping. Time: O(n log n).
7. Lowest Common Ancestor of a Binary Tree [Medium] (LeetCode #236)
Use postorder DFS to find both nodes, return ancestor when found. Time: O(n).
8. Word Ladder II [Hard] (LeetCode #126)
BFS for shortest path + backtracking to find all paths. Time: exponential.
9. Alien Dictionary [Hard] (LeetCode #269)
Topological sort using DFS or Kahn's algorithm on character graph.
10. N-Queens [Hard] (LeetCode #51)
Top 15 LeetCode Questions for 40+ LPA Jobs
Backtracking with column, diag1, diag2 constraints. Time: O(n!).
11. Word Search II [Hard] (LeetCode #212)
Use Trie + backtracking DFS to prune and search. Time: O(N * 4^L).
12. Edit Distance [Hard] (LeetCode #72)
DP with memoization. State: dp[i][j] = min ops to convert s1[:i] to s2[:j].
13. Burst Balloons [Hard] (LeetCode #312)
DP with divide-and-conquer. dp[i][j] = max coins for subarray (i,j).
14. Maximum XOR of Two Numbers in an Array [Hard] (LeetCode #421)
Use Trie to store bits and maximize XOR for each number. Time: O(n).
15. LFU Cache [Hard] (LeetCode #460)
Use two hashmap + doubly linked list to maintain freq and recency. Time: O(1).