DSA Practice
Practice data structures and algorithms by pattern — arrays, two pointers, sliding window, trees and graphs.
See the whole map.
Meet every essential data structure and pattern through one small, friendly win at a time.
- Running Sum of 1D Array — Carry one useful value forward · Warm-up
- Contains Duplicate — Remember what you have seen · Warm-up
- Two Sum — Look up the missing complement · Easy
- Valid Palindrome — Shrink from both ends · Easy
- Maximum Average Subarray I — Reuse a fixed-size window · Easy
- Range Sum Query — Immutable — Precompute once, answer many times · Easy
- Valid Parentheses — Last opened, first closed · Easy
- Reverse Linked List — Preserve the next node before rewiring · Easy
- Binary Search — Discard half using a sorted invariant · Easy
- Fibonacci Number — Define a small base case, then a smaller version · Warm-up
- Maximum Depth of Binary Tree — A node asks its children a smaller question · Easy
- Average of Levels in Binary Tree — Process neighbours layer by layer · Easy
- Last Stone Weight — Repeatedly take the most important item · Easy
- Flood Fill — Visit connected neighbours safely · Easy
- Find if Path Exists in Graph — Explore a frontier until you reach the goal · Easy
- Assign Cookies — Make the locally safe choice · Easy
- Meeting Overlap Check — Sort by start, compare with the last end · Warm-up
- Subsets — Choose, explore, unchoose · Stretch
- Climbing Stairs — Remember repeated smaller answers · Easy
- Single Number — Use XOR cancellation · Easy
- Autocomplete Starter — Share prefixes as a tree · Stretch
Connect the dots.
Return to each idea only when it has something new to teach you. No endless repetitions.
- Group Anagrams — Map many values to one signature · Easy
- Container With Most Water — Move the limiting side · Stretch
- Longest Substring Without Repeating Characters — Grow, then repair a variable window · Stretch
- Subarray Sum Equals K — Look up an earlier prefix · Stretch
- Min Stack — Store an answer alongside each item · Easy
- Daily Temperatures — Keep unresolved candidates ordered · Stretch
- Merge Two Sorted Lists — Build with a moving tail · Easy
- Linked List Cycle — Fast and slow pointers · Easy
- Search Insert Position — Search for the first valid position · Easy
- Koko Eating Bananas — Binary search the answer · Stretch
- Same Tree — Compare matching recursive structure · Easy
- Binary Tree Level Order Traversal — Collect one queue layer at a time · Easy
- Validate Binary Search Tree — Carry valid bounds downward · Stretch
- Kth Largest Element in an Array — Keep only the k most relevant values · Stretch
- Number of Islands — Start a traversal once per new component · Stretch
- Course Schedule — Track visiting and visited states · Stretch
- Redundant Connection — Merge groups and detect an existing connection · Stretch
- Insert Interval — Before, merge, after · Stretch
- Jump Game — Track the furthest safe reach · Stretch
- Permutations — Choose an unused option at each depth · Stretch
- House Robber — Take or skip with a small state · Easy
- Coin Change — Build the best answer for every smaller amount · Stretch
- Unique Paths — Build a grid from top and left · Easy
- Implement Trie (Prefix Tree) — Traverse character choices consistently · Stretch
- Counting Bits — Reuse the answer after removing one bit · Easy
Recognise and explain.
Meet familiar patterns in a mixed order, then practise the words you would use in an interview.
- Top K Frequent Elements — Count, then keep the best k · Stretch
- Product of Array Except Self — Carry information from both directions · Stretch
- 3Sum — Fix one value, solve a two-sum range · Stretch
- Longest Repeating Character Replacement — Keep a window valid under a budget · Stretch
- Decode String — Save outer context before nested work · Stretch
- Add Two Numbers — Advance two lists with a carry · Easy
- Lowest Common Ancestor of a BST — Use ordering to choose one branch · Easy
- Rotting Oranges — Expand one minute at a time · Stretch
- Pacific Atlantic Water Flow — Search backwards from both destinations · Stretch
- Combination Sum — Choose with a remaining target · Stretch
- Word Break — Mark reachable string boundaries · Stretch
- Time Based Key-Value Store — Search the latest valid timestamp · Stretch