Loading...
DSA

Top 50 DSA Problems Every Software Engineer
Must Solve Before an Interview

April 17, 2026  |  15 min read  |  InterviewClear Team

How to Use This List

This is not a random collection of LeetCode problem numbers. Every problem here was chosen because it teaches a pattern that repeats across dozens of interview questions. Once you recognise the pattern, solving new problems becomes fast.

For each problem: solve it once from scratch, then solve it again two days later without looking at your solution. If you cannot, you don't own the pattern yet. Time complexity targets are listed — knowing why a solution is O(n log n) is as important as knowing how to write it.

The 80/20 rule: These 50 problems cover roughly 80% of patterns tested at FAANG and top companies globally. Solve all 50 well and you can handle most coding rounds.

Arrays & Strings — 10 Problems

Pattern to master: Two pointers, sliding window, prefix sums, hash maps for O(1) lookups.

#ProblemDifficultyKey Pattern
1Two SumEasyHash map
2Best Time to Buy and Sell StockEasySingle pass, min tracker
3Longest Substring Without Repeating CharactersMediumSliding window
4Container With Most WaterMediumTwo pointers
53SumMediumSort + two pointers
6Product of Array Except SelfMediumPrefix & suffix products
7Maximum Subarray (Kadane's)MediumDP / greedy
8Minimum Window SubstringHardSliding window + frequency map
9Longest Palindromic SubstringMediumExpand around centre
10Trapping Rain WaterHardTwo pointers / prefix max

Linked Lists — 5 Problems

Pattern to master: Fast & slow pointers (Floyd's cycle), dummy nodes, reverse in place.

#ProblemDifficultyKey Pattern
11Reverse Linked ListEasyIterative pointer reversal
12Detect Cycle in Linked ListEasyFast & slow pointers
13Merge Two Sorted ListsEasyDummy head, merge
14LRU CacheMediumDoubly linked list + hash map
15Reorder ListMediumFind mid + reverse + merge

Trees & BST — 8 Problems

Pattern to master: DFS (pre/in/post order), BFS level order, recursive decomposition.

#ProblemDifficultyKey Pattern
16Maximum Depth of Binary TreeEasyDFS recursion
17Invert Binary TreeEasyDFS recursion
18Binary Tree Level Order TraversalMediumBFS with queue
19Validate Binary Search TreeMediumInorder / bounds passing
20Lowest Common Ancestor of BSTMediumBST property traversal
21Binary Tree Maximum Path SumHardPost-order, global max
22Construct Binary Tree from Preorder & InorderMediumRecursive rebuild + hash
23Serialize and Deserialize Binary TreeHardBFS / DFS + string encoding

Graphs — 7 Problems

Pattern to master: BFS/DFS on adjacency list, Union-Find, topological sort, Dijkstra.

#ProblemDifficultyKey Pattern
24Number of IslandsMediumBFS/DFS flood fill
25Clone GraphMediumBFS + hash map
26Course Schedule (Cycle detection)MediumTopological sort / DFS
27Pacific Atlantic Water FlowMediumMulti-source BFS
28Longest Consecutive SequenceMediumHash set O(n)
29Word LadderHardBFS shortest path
30Alien DictionaryHardTopological sort

Dynamic Programming — 10 Problems

Pattern to master: Define state, write recurrence, memoize or tabulate. Always draw the DP table first.

#ProblemDifficultyKey Pattern
31Climbing StairsEasyFibonacci DP
32Coin ChangeMediumUnbounded knapsack
33Longest Increasing SubsequenceMediumDP O(n²) / patience sort O(n log n)
34Word BreakMedium1D DP + set lookup
35House RobberMedium1D DP, skip adjacent
36Unique PathsMedium2D grid DP
37Longest Common SubsequenceMedium2D DP
38Edit DistanceHard2D DP
39Burst BalloonsHardInterval DP
40Regular Expression MatchingHard2D DP with backtracking

Stack & Queue — 5 Problems

#ProblemDifficultyKey Pattern
41Valid ParenthesesEasyStack matching
42Min StackMediumAuxiliary min stack
43Daily TemperaturesMediumMonotonic stack
44Largest Rectangle in HistogramHardMonotonic stack
45Sliding Window MaximumHardMonotonic deque

Heaps & Sorting — 5 Problems

#ProblemDifficultyKey Pattern
46Kth Largest Element in ArrayMediumMin-heap of size k
47Top K Frequent ElementsMediumHeap / bucket sort
48Find Median from Data StreamHardTwo heaps (min + max)
49Merge K Sorted ListsHardMin-heap / divide & conquer
50Meeting Rooms IIMediumSort + min-heap for end times

Suggested 8-Week Study Plan

  • Week 1–2: Arrays, Strings, Linked Lists (problems 1–15)
  • Week 3–4: Trees and Graphs (problems 16–30)
  • Week 5–6: Dynamic Programming (problems 31–40)
  • Week 7: Stacks, Queues, Heaps (problems 41–50)
  • Week 8: Timed mock problems + review weak spots
Important: Do not just read solutions. Type every solution from scratch. Run it. Then explain the time and space complexity out loud as if in an interview. That's the only way the pattern sticks.

Want Guided DSA Practice with a Coach?

Our DSA course covers all these patterns with live problem-solving sessions, mock interviews and personalised feedback from experienced engineers.

Book a Free Session
Our DSA Course

Structured DSA curriculum covering all patterns with live coaching, timed mock problems and weekly reviews.

View Course