Rahul Sonwalkar

Rahul Sonwalkar | Engineer & Product
Blog About Resume LinkedIn Github

Leetcode Problems With Strong Learning Outcomes

I did the Leetcode grind, and got offers from Uber, Facebook, LinkedIn, Nextdoor and WalmartLabs. Here are the problems that I think are crucial to developing a strong understanding of interview question patterns. (Remember simply knowing your patterns is half the battle :wink:)

Also must see (although a little outdated): Arden Dertat’s list.

Problems are grouped according to the concepts required to solve them.

Backtracking :

17. Letter Combinations of a Phone Number

22. Generate Parentheses

46. Permutations

78. Subsets

39. Combination Sum

247. Strobogrammatic Number II

491. Increasing Subsequences

90. Subsets II

267. Palindrome Permutation II

47. Permutations II

Bucket Sort

347. Top K Frequent Elements (Multiple ways to do it, but bucket sort is important.)

215. Kth Largest Element in an Array

Design Problems

146. LRU Cache

138. Copy List with Random Pointer

173. Binary Search Tree Iterator (Important is achieving the average run-time).

341. Flatten Nested List Iterator

535. Encode and Decode TinyURL

158. Read N Characters Given Read4 II - Call multiple times (also checkout the predecessor to this problem)

211. Add and Search Word - Data structure design

208. Implement Trie (Prefix Tree)

251. Flatten 2D Vector

Dynamic Programming :cold_sweat:

Tip: Try coming up with the recursive logic first. Converting that to DP is the easy part.

10. Regular Expression Matching

139. Word Break

140. Word Break II

322. Coin Change

91. Decode Ways

72. Edit Distance

300. Longest Increasing Subsequence

518. Coin Change 2

62. Unique Paths

55. Jump Game

304. Range Sum Query 2D - Immutable

63. Unique Paths II

416. Partition Equal Subset Sum

516. Longest Palindromic Subsequence

583. Delete Operation for Two Strings

Graph Problems

200. Number of Islands

547. Friend Circles

127. Word Ladder

79. Word Search

785. Is Graph Bipartite?

733. Flood Fill

490. The Maze

286. Walls and Gates

Graph related problems are frequently asked, and there are more quality problems out there that you should explore.


23. Merge k Sorted Lists

253. Meeting Rooms II

347. Top K Frequent Elements

621. Task Scheduler

215. Kth Largest Element in an Array

692. Top K Frequent Words

767. Reorganize String

Another important category, try to do more problems here.

Quality reading material on this category: Chapter 6 in Competitive Programmer’s Handbook

Random Sampling

528. Random Pick with Weight

398. Random Pick Index

Sliding Window Problems

3. Longest Substring Without Repeating Characters

76. Minimum Window Substring

438. Find All Anagrams in a String

340. Longest Substring with At Most K Distinct Characters

Good reading on this topic: Sourab Reddy’s Medium post

Topological Sort

207. Course Schedule

210. Course Schedule II

Tree Traversal

It is a good idea to practice doing preorder, inorder and postorder traversals both iteratively and recrusively. Helps a great deal with approaching tree problems.

Most tree problems are simple tweaks on a type of traversal, or simple DFS/BFS.

98. Validate Binary Search Tree

236. Lowest Common Ancestor of a Binary Tree

103. Binary Tree Zigzag Level Order Traversal

102. Binary Tree Level Order Traversal

543. Diameter of Binary Tree

199. Binary Tree Right Side View

94. Binary Tree Inorder Traversal

230. Kth Smallest Element in a BST

652. Find Duplicate Subtrees

144. Binary Tree Preorder Traversal

515. Find Largest Value in Each Tree Row


2. Add Two Numbers

20. Valid Parentheses

56. Merge Intervals

141. Linked List Cycle The O(N) with constant space trick is intresting and has applications in many Linked List problems.

121. Best Time to Buy and Sell Stock

11. Container With Most Water

238. Product of Array Except Self

33. Search in Rotated Sorted Array

31. Next Permutation

49. Group Anagrams

289. Game of Life

50. Pow(x, n)

25. Reverse Nodes in k-Group

560. Subarray Sum Equals K

19. Remove Nth Node From End of List

636. Exclusive Time of Functions

735. Asteroid Collision

150. Evaluate Reverse Polish Notation

29. Divide Two Integers Careful about overflows!

426. Convert Binary Search Tree to Sorted Doubly Linked List

18. 4Sum

166. Fraction to Recurring Decimal

567. Permutation in String

755. Pour Water

34. Find First and Last Position of Element in Sorted Array

209. Minimum Size Subarray Sum

852. Peak Index in a Mountain Array

325. Maximum Size Subarray Sum Equals k

654. Maximum Binary Tree

266. Palindrome Permutation

161. One Edit Distance