Data structures and algorithms
DSA Roadmap: Learn the Patterns Behind LeetCode
A 4-phase, 30-week plan of 153 problems grouped by the pattern that solves them. Each problem walks you from a hint, to the brute force, to the smarter idea, to a dry run and clean code, written the way a friend would explain it.
Use the tracker to mark problems as solved, queue them for revision, and see your progress on one page.
Arrays & Hashing
- Two SumEasy
- Contains DuplicateEasy
- Valid AnagramEasy
- Valid PalindromeEasy
- Best Time to Buy and Sell StockEasy
- Majority ElementEasy
- Move ZeroesEasy
- Remove Duplicates from Sorted ArrayEasy
- Merge Sorted ArrayEasy
- Intersection of Two ArraysEasy
- Group AnagramsMedium
- Top K Frequent ElementsMedium
- Product of Array Except SelfMedium
- Longest Consecutive SequenceMedium
- Subarray Sum Equals KMedium
- Maximum SubarrayMedium
- Maximum Product SubarrayMedium
- Encode and Decode StringsMedium
- Valid SudokuMedium
- Longest Palindromic SubstringMedium
Two Pointers
- Two Sum II - Input Array Is SortedEasy
- Is SubsequenceEasy
- 3SumMedium
- Container With Most WaterMedium
- Trapping Rain WaterHard
Sliding Window
Binary Search
Linked List
- Reverse Linked ListEasy
- Merge Two Sorted ListsEasy
- Linked List CycleEasy
- Middle of the Linked ListEasy
- Remove Nth Node From End of ListMedium
- Reorder ListMedium
- Add Two NumbersMedium
- Copy List with Random PointerMedium
- LRU CacheMedium
- Merge k Sorted ListsHard
Stack / Queue
- Valid ParenthesesEasy
- Implement Queue using StacksEasy
- Min StackMedium
- Evaluate Reverse Polish NotationMedium
- Daily TemperaturesMedium
- Car FleetMedium
- Largest Rectangle in HistogramMedium
- Sliding Window MaximumHard
Trees
- Invert Binary TreeEasy
- Maximum Depth of Binary TreeEasy
- Same TreeEasy
- Subtree of Another TreeEasy
- Balanced Binary TreeEasy
- Binary Tree Level Order TraversalMedium
- Binary Tree Right Side ViewMedium
- Diameter of Binary TreeMedium
- Validate Binary Search TreeMedium
- Kth Smallest Element in a BSTMedium
- Lowest Common Ancestor of a Binary TreeMedium
- Construct Binary Tree from Preorder and Inorder TraversalMedium
- Path Sum IIMedium
- Count Good Nodes in Binary TreeMedium
- Binary Tree Maximum Path SumHard
- Serialize and Deserialize Binary TreeHard
Heap / Priority Queue
Intervals
- Merge IntervalsMedium
- Insert IntervalMedium
- Non-overlapping IntervalsMedium
- Meeting Rooms IIMedium
Greedy
- Jump GameMedium
- Jump Game IIMedium
- Gas StationMedium
- Partition LabelsMedium
- Hand of StraightsMedium
Backtracking
- SubsetsMedium
- Subsets IIMedium
- PermutationsMedium
- Combination SumMedium
- Combination Sum IIMedium
- Letter Combinations of a Phone NumberMedium
- Word SearchMedium
- Palindrome PartitioningMedium
- N-QueensHard
Graphs
- Number of IslandsMedium
- Clone GraphMedium
- Max Area of IslandMedium
- Rotting OrangesMedium
- Pacific Atlantic Water FlowMedium
- Surrounded RegionsMedium
- Course ScheduleMedium
- Course Schedule IIMedium
- Graph Valid TreeMedium
- Number of Connected Components in an Undirected GraphMedium
- Word LadderMedium
- Redundant ConnectionMedium
- Network Delay TimeMedium
- Cheapest Flights Within K StopsMedium
- Min Cost to Connect All PointsMedium
- Critical Connections in a NetworkHard
Dynamic Programming
- Climbing StairsEasy
- Min Cost Climbing StairsEasy
- House RobberMedium
- House Robber IIMedium
- Palindromic SubstringsMedium
- Coin ChangeMedium
- Decode WaysMedium
- Word BreakMedium
- Longest Increasing SubsequenceMedium
- Partition Equal Subset SumMedium
- Unique PathsMedium
- Longest Common SubsequenceMedium
- Edit DistanceMedium
- Target SumMedium
- Combination Sum IVMedium
- Interleaving StringMedium
- Distinct SubsequencesHard
- Regular Expression MatchingHard
Trie
Union Find
- Number of ProvincesMedium
- Accounts MergeMedium
Bit Manipulation
- Single NumberEasy
- Number of 1 BitsEasy
- Counting BitsEasy
- Missing NumberEasy
- Sum of Two IntegersMedium
- Reverse BitsMedium
Arrays / Matrix
- Spiral MatrixMedium
- Set Matrix ZeroesMedium
- Rotate ImageMedium
Divide & Conquer
- Sort an ArrayMedium
Design
- Design TwitterMedium
- Design Hit CounterMedium
- Insert Delete GetRandom O(1)Medium
- Design Circular QueueMedium
- Design a Food Rating SystemMedium
Related guides
Common questions
How should I use the problem pages?
Try the problem yourself first. Each page gives hints one at a time, then the brute force and why it is slow, then the smarter idea and its name, then a step-by-step dry run and code in Python and Java.
In what order should I solve the problems?
In the order of the roadmap: core patterns first (arrays, hashing, two pointers, sliding window, binary search, linked lists, stacks), then trees to graphs, then dynamic programming and special topics, then mixed mock problems.
Do the pages explain the pattern or only the answer?
The pattern. Each problem explains how to recognise it, so the same idea works on a problem you have not seen before.
Are there video explanations?
Yes. After you open the approach, each problem page links to English and Hindi video explanations on YouTube. NeetCode (https://www.youtube.com/@NeetCode) explains most LeetCode problems in short videos, and take U forward (https://www.youtube.com/@takeUforward) covers patterns in depth.
Is it free?
Yes. No sign-up is needed. Your solved problems are kept in your browser, and you can optionally sign in to keep them across devices.