Menu

All DSA questions

DSA interview questions
#QuestionTopicDifficultyTypePractiseDone
1Majority Element: Find the Value That Fills More Than Half the ArrayArraysEasycodingLeetCode (opens in a new tab)
2Find Pivot Index: Balance Left and Right Prefix SumsArraysEasycodingLeetCode (opens in a new tab)
3Product of Array Except Self: Prefix and Suffix Products Without DivisionArraysMediumcodingLeetCode (opens in a new tab)
4Subarray Sum Equals K: Count Contiguous Slices With a Given SumArraysMediumcodingLeetCode (opens in a new tab)
5Subarray Sums Divisible by K: Count Matching Prefix RemaindersArraysMediumcodingLeetCode (opens in a new tab)
6Contiguous Array: Longest Balanced 0/1 Subarray via Prefix SumsArraysMediumcodingLeetCode (opens in a new tab)
7Shortest Subarray with Sum at Least K: Prefix Sums and a Monotonic DequeArraysHardcodingLeetCode (opens in a new tab)
8Maximum Subarray: Largest Sum of a Contiguous Slice with Kadane's AlgorithmArraysMediumcodingLeetCode (opens in a new tab)
9Maximum Product Subarray: Track Both the Largest and Smallest ProductArraysMediumcodingLeetCode (opens in a new tab)
10Maximum Subarray Sum with One Deletion: Kadane With Two StatesArraysMediumcodingLeetCode (opens in a new tab)
11Maximum Absolute Sum of Any Subarray: Run Kadane for Max and MinArraysMediumcodingLeetCode (opens in a new tab)
12Maximum Sum Circular Subarray: Kadane Plus Total Minus MinimumArraysMediumcodingLeetCode (opens in a new tab)
13Rotate Image: Turn a Square Matrix 90 Degrees Clockwise in PlaceArraysMediumcodingLeetCode (opens in a new tab)
14Spiral Matrix: Read a Grid in Clockwise Spiral OrderArraysMediumcodingLeetCode (opens in a new tab)
15Set Matrix Zeroes: Zero Out Rows and Columns in PlaceArraysMediumcodingLeetCode (opens in a new tab)
16Missing Number: Find the One Value Absent From 0 to nArraysEasycodingLeetCode (opens in a new tab)
17Find All Numbers Disappeared in an Array: Cyclic Sort and In-Place MarkingArraysEasycodingLeetCode (opens in a new tab)
18Set Mismatch: Find the Duplicate and the Missing Number With Cyclic SortArraysEasycodingLeetCode (opens in a new tab)
19Find All Duplicates in an Array: Cyclic Sort and Sign Marking in O(1) SpaceArraysMediumcodingLeetCode (opens in a new tab)
20First Missing Positive: Cyclic Sort Into Home Slots in O(n) Time, O(1) SpaceArraysHardcodingLeetCode (opens in a new tab)
21Contains Duplicate: Detect Whether Any Value Appears TwiceHashingEasycodingLeetCode (opens in a new tab)
22Valid Anagram: Check Whether Two Strings Use the Same LettersHashingEasycodingLeetCode (opens in a new tab)
23Two Sum: Find Two Indices That Add Up to a TargetHashingEasycodingLeetCode (opens in a new tab)
24First Unique Character in a String: Count, Then Scan AgainHashingEasycodingLeetCode (opens in a new tab)
25Longest Palindrome: Pair Up Letter Counts and Keep One CentreHashingEasycodingLeetCode (opens in a new tab)
26Ransom Note: Check Letter Supply Against Demand With a CounterHashingEasycodingLeetCode (opens in a new tab)
27Valid Sudoku: Check Rows, Columns and Boxes for Repeated DigitsHashingMediumcodingLeetCode (opens in a new tab)
28Group Anagrams: Bucket Words That Share the Same LettersHashingMediumcodingLeetCode (opens in a new tab)
29Longest Consecutive Sequence: Longest Run of Consecutive Integers in O(n)HashingMediumcodingLeetCode (opens in a new tab)
30Longest Common Prefix: Shared Start of a List of StringsStringsEasycodingLeetCode (opens in a new tab)
31Reverse String: Reverse a Character Array in PlaceStringsEasycodingLeetCode (opens in a new tab)
32Encode and Decode Strings: Serialise a List of Strings SafelyStringsMediumcodingGeeksforGeeks (opens in a new tab)
33String to Integer (atoi): Parse a Signed 32-bit Integer by HandStringsMediumcodingLeetCode (opens in a new tab)
34Number of 1 Bits: Count Set Bits in an IntegerBit ManipulationEasycodingLeetCode (opens in a new tab)
35Reverse Bits: Mirror the 32 Bits of an Unsigned IntegerBit ManipulationEasycodingLeetCode (opens in a new tab)
36Single Number: Find the Value That Appears Only Once Using XORBit ManipulationEasycodingLeetCode (opens in a new tab)
37Counting Bits: Set-Bit Counts for 0 to n with a One-Line DPBit ManipulationEasycodingLeetCode (opens in a new tab)
38Complement of Base 10 Integer: Flip Bits With an All-Ones MaskBit ManipulationEasycodingLeetCode (opens in a new tab)
39Sum of Two Integers: Add Without the Plus or Minus OperatorBit ManipulationMediumcodingLeetCode (opens in a new tab)
40Single Number III: Split Two Unique Values With One XOR BitBit ManipulationMediumcodingLeetCode (opens in a new tab)
41Valid Palindrome II: Palindrome After Deleting at Most One CharacterTwo PointersEasycodingLeetCode (opens in a new tab)
42Valid Palindrome: Check a Phrase While Ignoring Case and PunctuationTwo PointersEasycodingLeetCode (opens in a new tab)
43Move Zeroes: Shift Zeros to the End While Keeping OrderTwo PointersEasycodingLeetCode (opens in a new tab)
44Remove Duplicates from Sorted Array: Compact Unique Values In PlaceTwo PointersEasycodingLeetCode (opens in a new tab)
45Squares of a Sorted Array: Merge From Both Ends Without SortingTwo PointersEasycodingLeetCode (opens in a new tab)
46Segregate 0s and 1s: Partition a Binary Array in One PassTwo PointersEasycodingGeeksforGeeks (opens in a new tab)
47Backspace String Compare: Read Both Strings Backwards With Skip CountersTwo PointersEasycodingLeetCode (opens in a new tab)
48Two Sum II: Find a Pair With a Target Sum in a Sorted ArrayTwo PointersMediumcodingLeetCode (opens in a new tab)
493Sum: Find All Unique Triplets That Sum to ZeroTwo PointersMediumcodingLeetCode (opens in a new tab)
50Container With Most Water: Maximise Area Between Two LinesTwo PointersMediumcodingLeetCode (opens in a new tab)
51Sort Colors: One-Pass Three-Way Partition of 0s, 1s and 2sTwo PointersMediumcodingLeetCode (opens in a new tab)
523Sum Closest: Sort, Fix One Value, and Squeeze Two PointersTwo PointersMediumcodingLeetCode (opens in a new tab)
53Triplets with Smaller Sum: Count Many Pairs at Once With Two PointersTwo PointersMediumcodingGeeksforGeeks (opens in a new tab)
54Subarray Product Less Than K: Count Windows Ending at Each IndexTwo PointersMediumcodingLeetCode (opens in a new tab)
554Sum: Two Fixed Indices, Two Pointers and Careful Duplicate SkippingTwo PointersMediumcodingLeetCode (opens in a new tab)
56Shortest Unsorted Continuous Subarray: Find the Boundaries With Running Max and MinTwo PointersMediumcodingLeetCode (opens in a new tab)
57Trapping Rain Water: Total Water Held Between Elevation BarsTwo PointersHardcodingLeetCode (opens in a new tab)
58Implement Stack using Queues: LIFO Behaviour From FIFO PartsQueueEasycodingLeetCode (opens in a new tab)
59Implement Queue using Stacks: FIFO With Two Stacks in Amortised O(1)QueueEasycodingLeetCode (opens in a new tab)
60Number of Recent Calls: Count Requests in a Sliding Time WindowQueueEasycodingLeetCode (opens in a new tab)
61Design Circular Queue: A Fixed-Capacity Ring BufferQueueMediumcodingLeetCode (opens in a new tab)
62Best Time to Buy and Sell Stock: Maximum Profit From One TradeSliding WindowEasycodingLeetCode (opens in a new tab)
63Maximum Average Subarray I: Best Average Over a Fixed-Length WindowSliding WindowEasycodingLeetCode (opens in a new tab)
64Max Sum Subarray of Size K: The Fixed-Size Sliding WindowSliding WindowEasycodingGeeksforGeeks (opens in a new tab)
65Longest Substring Without Repeating Characters: Sliding WindowSliding WindowMediumcodingLeetCode (opens in a new tab)
66Longest Repeating Character Replacement: Window With At Most k ChangesSliding WindowMediumcodingLeetCode (opens in a new tab)
67Permutation in String: Does One String Contain a Rearrangement of Another?Sliding WindowMediumcodingLeetCode (opens in a new tab)
68Minimum Size Subarray Sum: Grow Until Valid, Then ShrinkSliding WindowMediumcodingLeetCode (opens in a new tab)
69Longest K Unique Characters Substring: A Window Bounded by a Distinct CountSliding WindowMediumcodingGeeksforGeeks (opens in a new tab)
70Fruit Into Baskets: Longest Window With at Most Two Distinct ValuesSliding WindowMediumcodingLeetCode (opens in a new tab)
71Max Consecutive Ones III: Longest Window With at Most K ZerosSliding WindowMediumcodingLeetCode (opens in a new tab)
72Find All Anagrams in a String: Fixed Window With Letter CountsSliding WindowMediumcodingLeetCode (opens in a new tab)
73Minimum Window Substring: Shortest Slice Containing Every Required CharacterSliding WindowHardcodingLeetCode (opens in a new tab)
74Sliding Window Maximum: Max of Every Window With a Monotonic DequeSliding WindowHardcodingLeetCode (opens in a new tab)
75Substring with Concatenation of All Words: Word-Sized Sliding Windows per OffsetSliding WindowHardcodingLeetCode (opens in a new tab)
76Valid Parentheses: Check That Every Bracket Closes in the Right OrderStackEasycodingLeetCode (opens in a new tab)
77Remove All Adjacent Duplicates In String: Cancel Pairs With a StackStackEasycodingLeetCode (opens in a new tab)
78Min Stack: A Stack That Returns Its Minimum in Constant TimeStackMediumcodingLeetCode (opens in a new tab)
79Evaluate Reverse Polish Notation: Compute a Postfix ExpressionStackMediumcodingLeetCode (opens in a new tab)
80Remove All Adjacent Duplicates in String II: Stack of Character CountsStackMediumcodingLeetCode (opens in a new tab)
81Simplify Path: Canonical Unix Paths With a Stack of Directory NamesStackMediumcodingLeetCode (opens in a new tab)
82Next Greater Element I: First Larger Value to the RightStackEasycodingLeetCode (opens in a new tab)
83Daily Temperatures: Days Until a Warmer Day With a Monotonic StackStackMediumcodingLeetCode (opens in a new tab)
84Car Fleet: Count the Groups of Cars Arriving at a DestinationStackMediumcodingLeetCode (opens in a new tab)
85Next Greater Element II: Monotonic Stack Over a Circular ArrayStackMediumcodingLeetCode (opens in a new tab)
86Remove Nodes From Linked List: Keep Nodes With Nothing Larger to Their RightStackMediumcodingLeetCode (opens in a new tab)
87Remove K Digits: Smallest Number With a Greedy Monotonic StackStackMediumcodingLeetCode (opens in a new tab)
88132 Pattern: Find a Low, High, Middle Subsequence in One PassStackMediumcodingLeetCode (opens in a new tab)
89Largest Rectangle in Histogram: Biggest Area Under the BarsStackHardcodingLeetCode (opens in a new tab)
90Binary Search: Find a Target in a Sorted Array in O(log n)Binary SearchEasycodingLeetCode (opens in a new tab)
91Ceil in Sorted Array: Lower-Bound Binary SearchBinary SearchEasycodingGeeksforGeeks (opens in a new tab)
92Time Based Key-Value Store: Versioned Lookups with Binary SearchBinary SearchMediumcoding, architectureLeetCode (opens in a new tab)
93Find First and Last Position of a Value: Lower and Upper Bound Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
94Number of Occurrence: Count a Value with Two Boundary SearchesBinary SearchMediumcodingGeeksforGeeks (opens in a new tab)
95Median of Two Sorted Arrays: Partition Binary Search in O(log min(m, n))Binary SearchHardcodingLeetCode (opens in a new tab)
96Find Rotation Count: The Index of the Minimum Is the AnswerBinary SearchEasycodingGeeksforGeeks (opens in a new tab)
97Find Minimum in Rotated Sorted Array: Binary Search Against the Right EndBinary SearchMediumcodingLeetCode (opens in a new tab)
98Search in Rotated Sorted Array: One-Pass Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
99Peak Index in a Mountain Array: Binary Search on the SlopeBinary SearchMediumcodingLeetCode (opens in a new tab)
100Find Peak Element: Follow the Uphill Side with Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
101Koko Eating Bananas: Binary Search on the AnswerBinary SearchMediumcodingLeetCode (opens in a new tab)
102Minimum Number of Days to Make m Bouquets: Binary Search on the DayBinary SearchMediumcodingLeetCode (opens in a new tab)
103Aggressive Cows: Maximise the Minimum Gap with Binary SearchBinary SearchMediumcodingGeeksforGeeks (opens in a new tab)
104Maximum Candies Allocated to K Children: Binary Search on the ShareBinary SearchMediumcodingLeetCode (opens in a new tab)
105Capacity To Ship Packages Within D Days: Binary Search on CapacityBinary SearchMediumcodingLeetCode (opens in a new tab)
106Split Array Largest Sum: Binary Search on the Largest PartBinary SearchHardcodingLeetCode (opens in a new tab)
107Search a 2D Matrix: Binary Search over a Flattened Sorted GridBinary SearchMediumcodingLeetCode (opens in a new tab)
108Search a 2D Matrix II: Staircase Search from the Top-Right CornerBinary SearchMediumcodingLeetCode (opens in a new tab)
109Kth Smallest Element in a Sorted Matrix: Binary Search on ValuesBinary SearchMediumcodingLeetCode (opens in a new tab)
110Merge Two Sorted Lists: Dummy Head Iteration and RecursionLinked ListEasycodingLeetCode (opens in a new tab)
111Remove Nth Node From End of List: One Pass with a Gap of nLinked ListMediumcodingLeetCode (opens in a new tab)
112Copy List with Random Pointer: Hash Map and Interleaving SolutionsLinked ListMediumcodingLeetCode (opens in a new tab)
113Add Two Numbers: Digit-by-Digit Addition on Linked ListsLinked ListMediumcodingLeetCode (opens in a new tab)
114LRU Cache: Hash Map Plus Doubly Linked List for O(1) OperationsLinked ListMediumcoding, architectureLeetCode (opens in a new tab)
115Linked List Cycle: Floyd's Fast and Slow PointersLinked ListEasycodingLeetCode (opens in a new tab)
116Happy Number: Detect a Cycle in a Digit-Square SequenceLinked ListEasycodingLeetCode (opens in a new tab)
117Middle of the Linked List: Find It in One Pass With Fast and Slow PointersLinked ListEasycodingLeetCode (opens in a new tab)
118Palindrome Linked List: Find the Middle, Reverse the Back Half, CompareLinked ListEasycodingLeetCode (opens in a new tab)
119Reorder List: Find the Middle, Reverse, Then InterleaveLinked ListMediumcodingLeetCode (opens in a new tab)
120Find the Duplicate Number: Cycle Detection on an ArrayLinked ListMediumcodingLeetCode (opens in a new tab)
121Linked List Cycle II: Find Where the Cycle Starts With Floyd's AlgorithmLinked ListMediumcodingLeetCode (opens in a new tab)
122Circular Array Loop: Fast and Slow Pointers on Index JumpsLinked ListMediumcodingLeetCode (opens in a new tab)
123Reverse Linked List: Iterative and Recursive SolutionsLinked ListEasycodingLeetCode (opens in a new tab)
124Reverse Linked List II: Reverse a Sublist in One Pass With a Dummy NodeLinked ListMediumcodingLeetCode (opens in a new tab)
125Swap Nodes in Pairs: Rewire Every Two Nodes With a Dummy HeadLinked ListMediumcodingLeetCode (opens in a new tab)
126Rotate List: Close the Ring, Then Cut It at the New TailLinked ListMediumcodingLeetCode (opens in a new tab)
127Reverse Nodes in k-Group: In-Place Group Reversal on a Linked ListLinked ListHardcodingLeetCode (opens in a new tab)
128Invert Binary Tree: Recursive and Iterative Mirror SolutionsTreesEasycodingLeetCode (opens in a new tab)
129Maximum Depth of Binary Tree: Recursive DFS, Iterative DFS and BFSTreesEasycodingLeetCode (opens in a new tab)
130Diameter of Binary Tree: Longest Path via Post-Order HeightsTreesEasycodingLeetCode (opens in a new tab)
131Balanced Binary Tree: Height Check with Early ExitTreesEasycodingLeetCode (opens in a new tab)
132Same Tree: Comparing Two Binary Trees Recursively and IterativelyTreesEasycodingLeetCode (opens in a new tab)
133Subtree of Another Tree: Brute-Force Matching and Linear SerialisationTreesEasycodingLeetCode (opens in a new tab)
134Count Good Nodes in Binary Tree: DFS Carrying the Path MaximumTreesMediumcodingLeetCode (opens in a new tab)
135Construct Binary Tree from Preorder and Inorder TraversalTreesMediumcodingLeetCode (opens in a new tab)
136Lowest Common Ancestor of a Binary Tree: One Post-Order SearchTreesMediumcodingLeetCode (opens in a new tab)
137Binary Tree Maximum Path Sum: Post-Order Gains with a Global BestTreesHardcodingLeetCode (opens in a new tab)
138Serialize and Deserialize Binary Tree: Preorder with Null MarkersTreesHardcodingLeetCode (opens in a new tab)
139Binary Tree Level Order Traversal: BFS with a Queue, Level by LevelTreesMediumcodingLeetCode (opens in a new tab)
140Binary Tree Right Side View: Last Node of Each LevelTreesMediumcodingLeetCode (opens in a new tab)
141Implement Trie (Prefix Tree): Insert, Search and Prefix LookupTreesMediumcoding, architectureLeetCode (opens in a new tab)
142Design Add and Search Words: Trie Search with WildcardsTreesMediumcoding, architectureLeetCode (opens in a new tab)
143Extra Characters in a String: Dynamic Programming over a Trie of WordsTreesMediumcodingLeetCode (opens in a new tab)
144Search Suggestions System: Autocomplete with a Trie or Sorted Binary SearchTreesMediumcodingLeetCode (opens in a new tab)
145Word Search II: Find Many Words in a Grid with a Trie and BacktrackingTreesHardcodingLeetCode (opens in a new tab)
146Convert Sorted Array to BST: Pick the Middle, Recurse on HalvesBSTEasycodingLeetCode (opens in a new tab)
147Validate Binary Search Tree: Bounds Recursion and Inorder CheckBSTMediumcodingLeetCode (opens in a new tab)
148Kth Smallest Element in a BST: Inorder Traversal with Early StopBSTMediumcodingLeetCode (opens in a new tab)
149Lowest Common Ancestor of a BST: Follow the Split PointBSTMediumcodingLeetCode (opens in a new tab)
150Insert into a BST: Walk Down to the Empty SpotBSTMediumcodingLeetCode (opens in a new tab)
151Delete Node in a BST: Leaf, One Child and Two Children CasesBSTMediumcodingLeetCode (opens in a new tab)
152Kth Largest Element in a Stream: Size-k Min-HeapHeapEasycodingLeetCode (opens in a new tab)
153Last Stone Weight: Simulating Smashes with a Max-HeapHeapEasycodingLeetCode (opens in a new tab)
154Top K Frequent Elements: Return the k Most Common ValuesHeapMediumcodingLeetCode (opens in a new tab)
155K Closest Points to Origin: Bounded Max-Heap and QuickselectHeapMediumcodingLeetCode (opens in a new tab)
156Kth Largest Element in an Array: Heap, Quickselect and CountingHeapMediumcodingLeetCode (opens in a new tab)
157Task Scheduler: Cooldowns with a Max-Heap or a Counting FormulaHeapMediumcodingLeetCode (opens in a new tab)
158Min Cost to Connect Ropes: Always Join the Two ShortestHeapMediumcodingGeeksforGeeks (opens in a new tab)
159Sort Characters By Frequency: Count, Then Order by a Heap or BucketsHeapMediumcodingLeetCode (opens in a new tab)
160Find K Closest Elements: Binary Search for the Best WindowHeapMediumcodingLeetCode (opens in a new tab)
161Reorganize String: Place the Most Frequent Character First, Never Twice in a RowHeapMediumcodingLeetCode (opens in a new tab)
162Maximum Frequency Stack: Pop the Most Frequent Value in O(1)HeapHardcoding, architectureLeetCode (opens in a new tab)
163Maximum Sum Combination: The K Largest Pair Sums with a Max-HeapHeapMediumcodingGeeksforGeeks (opens in a new tab)
164Find Median from Data Stream: Two Heaps Kept in BalanceHeapHardcodingLeetCode (opens in a new tab)
165Sliding Window Median: Two Heaps with Lazy DeletionHeapHardcodingLeetCode (opens in a new tab)
166IPO: Maximise Capital by Picking the Best Affordable Project Each RoundHeapHardcodingLeetCode (opens in a new tab)
167Design Twitter: News Feed with a K-Way Heap MergeHeapMediumcoding, architectureLeetCode (opens in a new tab)
168Merge k Sorted Lists: Min-Heap and Divide-and-Conquer SolutionsHeapHardcodingLeetCode (opens in a new tab)
169Smallest Range Covering Elements from K Lists: K-Way Merge with a Min-HeapHeapHardcodingLeetCode (opens in a new tab)
170Jump Game: Can You Reach the Last Index? Greedy Furthest ReachGreedyMediumcodingLeetCode (opens in a new tab)
171Jump Game II: Fewest Jumps to the End with Greedy Level-by-Level BFSGreedyMediumcodingLeetCode (opens in a new tab)
172Gas Station: Find the Start of a Circular Route in One Greedy PassGreedyMediumcodingLeetCode (opens in a new tab)
173Hand of Straights: Group Cards into Consecutive Runs GreedilyGreedyMediumcodingLeetCode (opens in a new tab)
174Merge Triplets to Form Target: Keep Only Triplets That Never OvershootGreedyMediumcodingLeetCode (opens in a new tab)
175Partition Labels: Split a String So Each Letter Stays in One PartGreedyMediumcodingLeetCode (opens in a new tab)
176Valid Parenthesis String: Track a Range of Open Counts GreedilyGreedyMediumcodingLeetCode (opens in a new tab)
177Maximum Length of Pair Chain: Greedy by Earliest EndGreedyMediumcodingLeetCode (opens in a new tab)
178Minimum Add to Make Parentheses Valid: Count Unmatched Brackets in One PassGreedyMediumcodingLeetCode (opens in a new tab)
179Remove Duplicate Letters: Smallest Order with a Greedy Monotonic StackGreedyMediumcodingLeetCode (opens in a new tab)
180Meeting Rooms: Check Whether One Person Can Attend Every MeetingGreedyEasycodingGeeksforGeeks (opens in a new tab)
181Merge Intervals: Combine Every Overlapping RangeGreedyMediumcodingLeetCode (opens in a new tab)
182Insert Interval: Add a Range to a Sorted List and Merge OverlapsGreedyMediumcodingLeetCode (opens in a new tab)
183Non-overlapping Intervals: Fewest Removals to Eliminate OverlapsGreedyMediumcodingLeetCode (opens in a new tab)
184Interval List Intersections: Two Pointers over Sorted RangesGreedyMediumcodingLeetCode (opens in a new tab)
185Meeting Rooms II: Count the Rooms with a Min-Heap or a Sweep LineGreedyMediumcodingGeeksforGeeks (opens in a new tab)
186My Calendar I: Accept Bookings Only When They Do Not OverlapGreedyMediumcodingLeetCode (opens in a new tab)
187Generate Parentheses: List Every Balanced String of n PairsBacktrackingMediumcodingLeetCode (opens in a new tab)
188Subsets: Generate the Power Set with Include/Exclude BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
189Permutations: Every Ordering of Distinct Values with BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
190Subsets II: Power Set Without Duplicates When Values RepeatBacktrackingMediumcodingLeetCode (opens in a new tab)
191Letter Combinations of a Phone Number: Cartesian Product by BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
192Letter Case Permutation: Branch Twice on Every LetterBacktrackingMediumcodingLeetCode (opens in a new tab)
193Combination Sum: Reach a Target with Reusable Values via BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
194Combination Sum II: Use Each Value Once and Avoid Duplicate AnswersBacktrackingMediumcodingLeetCode (opens in a new tab)
195Word Search: Trace a Word Through a Letter Grid with DFS BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
196Palindrome Partitioning: Split a String into Palindromes by BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
197N-Queens: Place Non-Attacking Queens Row by Row with BacktrackingBacktrackingHardcodingLeetCode (opens in a new tab)
198Sudoku Solver: Backtracking with Constraint Sets and Smart Cell ChoiceBacktrackingHardcodingLeetCode (opens in a new tab)
199Find if Path Exists in Graph: Reachability with BFS or Union-FindGraphEasycodingLeetCode (opens in a new tab)
200Clone Graph: Deep-Copy a Connected Graph with a Hash Map and BFS or DFSGraphMediumcodingLeetCode (opens in a new tab)
201Number of Provinces: Count Components in an Adjacency MatrixGraphMediumcodingLeetCode (opens in a new tab)
202Word Ladder: Shortest Word Transformation with BFS and Wildcard BucketsGraphHardcodingLeetCode (opens in a new tab)
203Reconstruct Itinerary: Eulerian Path with Hierholzer's AlgorithmGraphHardcodingLeetCode (opens in a new tab)
204Flood Fill: Repaint a Connected Region with DFS or BFSGraphEasycodingLeetCode (opens in a new tab)
205Island Perimeter: Count Land Edges Without a TraversalGraphEasycodingLeetCode (opens in a new tab)
206Number of Islands: Count Connected Land Cells with BFS, DFS or Union-FindGraphMediumcodingLeetCode (opens in a new tab)
207Max Area of Island: Largest Connected Land Region with Flood FillGraphMediumcodingLeetCode (opens in a new tab)
208Pacific Atlantic Water Flow: Reverse Multi-Source BFS from Both OceansGraphMediumcodingLeetCode (opens in a new tab)
209Surrounded Regions: Capture Enclosed Cells by Flood-Filling from the BorderGraphMediumcodingLeetCode (opens in a new tab)
210Rotting Oranges: Minutes to Spread via Level-by-Level Multi-Source BFSGraphMediumcodingLeetCode (opens in a new tab)
211Number of Closed Islands: Sink the Border, Then CountGraphMediumcodingLeetCode (opens in a new tab)
212Course Schedule: Detect a Cycle in a Prerequisite Graph with Kahn's AlgorithmGraphMediumcodingLeetCode (opens in a new tab)
213Course Schedule II: Return a Valid Course Order with Topological SortGraphMediumcodingLeetCode (opens in a new tab)
214Topological Sort: Order a DAG with Kahn's Algorithm or DFSGraphMediumcodingGeeksforGeeks (opens in a new tab)
215Minimum Height Trees: Trim Leaves Until the Centre RemainsGraphMediumcodingLeetCode (opens in a new tab)
216Alien Dictionary: Derive a Letter Order from Sorted Words with Topological SortGraphHardcodingGeeksforGeeks (opens in a new tab)
217Graph Valid Tree: Check Edge Count, Connectivity and Cycles with Union-FindGraphMediumcodingGeeksforGeeks (opens in a new tab)
218Number of Connected Components in an Undirected Graph with Union-FindGraphMediumcodingGeeksforGeeks (opens in a new tab)
219Redundant Connection: Find the Edge That Closes a Cycle with Union-FindGraphMediumcodingLeetCode (opens in a new tab)
220Is Graph Bipartite?: Two-Colour Every ComponentGraphMediumcodingLeetCode (opens in a new tab)
221Path With Minimum Effort: Minimise the Largest Step on a GridGraphMediumcodingLeetCode (opens in a new tab)
222Network Delay Time: Single-Source Shortest Paths with Dijkstra's AlgorithmGraphMediumcodingLeetCode (opens in a new tab)
223Cheapest Flights Within K Stops: Bounded Bellman-Ford for Limited HopsGraphMediumcodingLeetCode (opens in a new tab)
224Min Cost to Connect All Points: Minimum Spanning Tree with Prim or KruskalGraphMediumcodingLeetCode (opens in a new tab)
225Swim in Rising Water: Minimax Path with a Modified DijkstraGraphHardcodingLeetCode (opens in a new tab)
226Climbing Stairs: Count Ways with a Fibonacci-Style DPDynamic ProgrammingEasycodingLeetCode (opens in a new tab)
227Min Cost Climbing Stairs: Cheapest Path to the Top with 1D DPDynamic ProgrammingEasycodingLeetCode (opens in a new tab)
228House Robber: Maximum Non-Adjacent Sum with Take-or-Skip DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
229House Robber II: Non-Adjacent Maximum Sum When Houses Form a CircleDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
230Decode Ways: Count Digit-to-Letter Decodings with Prefix DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
231Coin Change: Fewest Coins with Bottom-Up DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
232Word Break: Can a String Be Split into Dictionary Words? Prefix DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
233Longest Increasing Subsequence: O(n^2) DP and O(n log n) Patience SortingDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
234Best Time to Buy and Sell Stock with Cooldown: State-Machine DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
235Partition Equal Subset Sum: 0/1 Knapsack on Half the TotalDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
236Coin Change II: Count Combinations That Make an AmountDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
237Target Sum: Count Sign Assignments with Subset-Sum DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
2380 - 1 Knapsack Problem: Take or Skip Each Item OnceDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
239Subset Sum Problem: Track Every Reachable TotalDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
240Count Subsets with Sum: Add Up the Ways, Not Just True or FalseDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
241Partition Into 2 Subsets with Min Sum Diff: Subset Sum Up to Half the TotalDynamic ProgrammingHardcodingGeeksforGeeks (opens in a new tab)
242Longest Palindromic Substring: Expand Around Centres or Interval DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
243Palindromic Substrings: Count Every Palindrome by Expanding Around CentresDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
244Unique Paths: Count Grid Routes with 2D DP or a Binomial CoefficientDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
245Longest Common Subsequence: The Classic Two-String DP TableDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
246Interleaving String: Can Two Strings Merge into a Third? 2D DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
247Edit Distance: Levenshtein Distance with a 2D DP TableDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
248Burst Balloons: Interval DP by Choosing the Last Balloon to BurstDynamic ProgrammingHardcodingLeetCode (opens in a new tab)
249Regular Expression Matching: Dot and Star with a 2D DP TableDynamic ProgrammingHardcodingLeetCode (opens in a new tab)

Ticks are saved in this browser only. No account needed.

Concept review

Continue preparing

Search
Filter by type