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)
63Max Sum Subarray of Size K: The Fixed-Size Sliding WindowSliding WindowEasycodingGeeksforGeeks (opens in a new tab)
64Longest Substring Without Repeating Characters: Sliding WindowSliding WindowMediumcodingLeetCode (opens in a new tab)
65Longest Repeating Character Replacement: Window With At Most k ChangesSliding WindowMediumcodingLeetCode (opens in a new tab)
66Permutation in String: Does One String Contain a Rearrangement of Another?Sliding WindowMediumcodingLeetCode (opens in a new tab)
67Minimum Size Subarray Sum: Grow Until Valid, Then ShrinkSliding WindowMediumcodingLeetCode (opens in a new tab)
68Longest K Unique Characters Substring: A Window Bounded by a Distinct CountSliding WindowMediumcodingGeeksforGeeks (opens in a new tab)
69Fruit Into Baskets: Longest Window With at Most Two Distinct ValuesSliding WindowMediumcodingLeetCode (opens in a new tab)
70Max Consecutive Ones III: Longest Window With at Most K ZerosSliding WindowMediumcodingLeetCode (opens in a new tab)
71Find All Anagrams in a String: Fixed Window With Letter CountsSliding WindowMediumcodingLeetCode (opens in a new tab)
72Minimum Window Substring: Shortest Slice Containing Every Required CharacterSliding WindowHardcodingLeetCode (opens in a new tab)
73Sliding Window Maximum: Max of Every Window With a Monotonic DequeSliding WindowHardcodingLeetCode (opens in a new tab)
74Substring with Concatenation of All Words: Word-Sized Sliding Windows per OffsetSliding WindowHardcodingLeetCode (opens in a new tab)
75Valid Parentheses: Check That Every Bracket Closes in the Right OrderStackEasycodingLeetCode (opens in a new tab)
76Remove All Adjacent Duplicates In String: Cancel Pairs With a StackStackEasycodingLeetCode (opens in a new tab)
77Min Stack: A Stack That Returns Its Minimum in Constant TimeStackMediumcodingLeetCode (opens in a new tab)
78Evaluate Reverse Polish Notation: Compute a Postfix ExpressionStackMediumcodingLeetCode (opens in a new tab)
79Remove All Adjacent Duplicates in String II: Stack of Character CountsStackMediumcodingLeetCode (opens in a new tab)
80Simplify Path: Canonical Unix Paths With a Stack of Directory NamesStackMediumcodingLeetCode (opens in a new tab)
81Next Greater Element I: First Larger Value to the RightStackEasycodingLeetCode (opens in a new tab)
82Daily Temperatures: Days Until a Warmer Day With a Monotonic StackStackMediumcodingLeetCode (opens in a new tab)
83Car Fleet: Count the Groups of Cars Arriving at a DestinationStackMediumcodingLeetCode (opens in a new tab)
84Next Greater Element II: Monotonic Stack Over a Circular ArrayStackMediumcodingLeetCode (opens in a new tab)
85Remove Nodes From Linked List: Keep Nodes With Nothing Larger to Their RightStackMediumcodingLeetCode (opens in a new tab)
86Remove K Digits: Smallest Number With a Greedy Monotonic StackStackMediumcodingLeetCode (opens in a new tab)
87132 Pattern: Find a Low, High, Middle Subsequence in One PassStackMediumcodingLeetCode (opens in a new tab)
88Largest Rectangle in Histogram: Biggest Area Under the BarsStackHardcodingLeetCode (opens in a new tab)
89Binary Search: Find a Target in a Sorted Array in O(log n)Binary SearchEasycodingLeetCode (opens in a new tab)
90Ceil in Sorted Array: Lower-Bound Binary SearchBinary SearchEasycodingGeeksforGeeks (opens in a new tab)
91Time Based Key-Value Store: Versioned Lookups with Binary SearchBinary SearchMediumcoding, architectureLeetCode (opens in a new tab)
92Find First and Last Position of a Value: Lower and Upper Bound Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
93Number of Occurrence: Count a Value with Two Boundary SearchesBinary SearchEasycodingGeeksforGeeks (opens in a new tab)
94Median of Two Sorted Arrays: Partition Binary Search in O(log min(m, n))Binary SearchHardcodingLeetCode (opens in a new tab)
95Find Rotation Count: The Index of the Minimum Is the AnswerBinary SearchEasycodingGeeksforGeeks (opens in a new tab)
96Find Minimum in Rotated Sorted Array: Binary Search Against the Right EndBinary SearchMediumcodingLeetCode (opens in a new tab)
97Search in Rotated Sorted Array: One-Pass Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
98Peak Index in a Mountain Array: Binary Search on the SlopeBinary SearchMediumcodingLeetCode (opens in a new tab)
99Find Peak Element: Follow the Uphill Side with Binary SearchBinary SearchMediumcodingLeetCode (opens in a new tab)
100Koko Eating Bananas: Binary Search on the AnswerBinary SearchMediumcodingLeetCode (opens in a new tab)
101Minimum Number of Days to Make m Bouquets: Binary Search on the DayBinary SearchMediumcodingLeetCode (opens in a new tab)
102Aggressive Cows: Maximise the Minimum Gap with Binary SearchBinary SearchMediumcodingGeeksforGeeks (opens in a new tab)
103Maximum Candies Allocated to K Children: Binary Search on the ShareBinary SearchMediumcodingLeetCode (opens in a new tab)
104Capacity To Ship Packages Within D Days: Binary Search on CapacityBinary SearchMediumcodingLeetCode (opens in a new tab)
105Split Array Largest Sum: Binary Search on the Largest PartBinary SearchHardcodingLeetCode (opens in a new tab)
106Search a 2D Matrix: Binary Search over a Flattened Sorted GridBinary SearchMediumcodingLeetCode (opens in a new tab)
107Search a 2D Matrix II: Staircase Search from the Top-Right CornerBinary SearchMediumcodingLeetCode (opens in a new tab)
108Kth Smallest Element in a Sorted Matrix: Binary Search on ValuesBinary SearchMediumcodingLeetCode (opens in a new tab)
109Merge Two Sorted Lists: Dummy Head Iteration and RecursionLinked ListEasycodingLeetCode (opens in a new tab)
110Remove Nth Node From End of List: One Pass with a Gap of nLinked ListMediumcodingLeetCode (opens in a new tab)
111Copy List with Random Pointer: Hash Map and Interleaving SolutionsLinked ListMediumcodingLeetCode (opens in a new tab)
112Add Two Numbers: Digit-by-Digit Addition on Linked ListsLinked ListMediumcodingLeetCode (opens in a new tab)
113LRU Cache: Hash Map Plus Doubly Linked List for O(1) OperationsLinked ListMediumcoding, architectureLeetCode (opens in a new tab)
114Linked List Cycle: Floyd's Fast and Slow PointersLinked ListEasycodingLeetCode (opens in a new tab)
115Happy Number: Detect a Cycle in a Digit-Square SequenceLinked ListEasycodingLeetCode (opens in a new tab)
116Middle of the Linked List: Find It in One Pass With Fast and Slow PointersLinked ListEasycodingLeetCode (opens in a new tab)
117Palindrome Linked List: Find the Middle, Reverse the Back Half, CompareLinked ListEasycodingLeetCode (opens in a new tab)
118Reorder List: Find the Middle, Reverse, Then InterleaveLinked ListMediumcodingLeetCode (opens in a new tab)
119Find the Duplicate Number: Cycle Detection on an ArrayLinked ListMediumcodingLeetCode (opens in a new tab)
120Linked List Cycle II: Find Where the Cycle Starts With Floyd's AlgorithmLinked ListMediumcodingLeetCode (opens in a new tab)
121Circular Array Loop: Fast and Slow Pointers on Index JumpsLinked ListMediumcodingLeetCode (opens in a new tab)
122Reverse Linked List: Iterative and Recursive SolutionsLinked ListEasycodingLeetCode (opens in a new tab)
123Reverse Linked List II: Reverse a Sublist in One Pass With a Dummy NodeLinked ListMediumcodingLeetCode (opens in a new tab)
124Swap Nodes in Pairs: Rewire Every Two Nodes With a Dummy HeadLinked ListMediumcodingLeetCode (opens in a new tab)
125Rotate List: Close the Ring, Then Cut It at the New TailLinked ListMediumcodingLeetCode (opens in a new tab)
126Reverse Nodes in k-Group: In-Place Group Reversal on a Linked ListLinked ListHardcodingLeetCode (opens in a new tab)
127Invert Binary Tree: Recursive and Iterative Mirror SolutionsTreesEasycodingLeetCode (opens in a new tab)
128Maximum Depth of Binary Tree: Recursive DFS, Iterative DFS and BFSTreesEasycodingLeetCode (opens in a new tab)
129Diameter of Binary Tree: Longest Path via Post-Order HeightsTreesEasycodingLeetCode (opens in a new tab)
130Balanced Binary Tree: Height Check with Early ExitTreesEasycodingLeetCode (opens in a new tab)
131Same Tree: Comparing Two Binary Trees Recursively and IterativelyTreesEasycodingLeetCode (opens in a new tab)
132Subtree of Another Tree: Brute-Force Matching and Linear SerialisationTreesEasycodingLeetCode (opens in a new tab)
133Count Good Nodes in Binary Tree: DFS Carrying the Path MaximumTreesMediumcodingLeetCode (opens in a new tab)
134Construct Binary Tree from Preorder and Inorder TraversalTreesMediumcodingLeetCode (opens in a new tab)
135Lowest Common Ancestor of a Binary Tree: One Post-Order SearchTreesMediumcodingLeetCode (opens in a new tab)
136Binary Tree Maximum Path Sum: Post-Order Gains with a Global BestTreesHardcodingLeetCode (opens in a new tab)
137Serialize and Deserialize Binary Tree: Preorder with Null MarkersTreesHardcodingLeetCode (opens in a new tab)
138Binary Tree Level Order Traversal: BFS with a Queue, Level by LevelTreesMediumcodingLeetCode (opens in a new tab)
139Binary Tree Right Side View: Last Node of Each LevelTreesMediumcodingLeetCode (opens in a new tab)
140Implement Trie (Prefix Tree): Insert, Search and Prefix LookupTreesMediumcoding, architectureLeetCode (opens in a new tab)
141Design Add and Search Words: Trie Search with WildcardsTreesMediumcoding, architectureLeetCode (opens in a new tab)
142Extra Characters in a String: Dynamic Programming over a Trie of WordsTreesMediumcodingLeetCode (opens in a new tab)
143Search Suggestions System: Autocomplete with a Trie or Sorted Binary SearchTreesMediumcodingLeetCode (opens in a new tab)
144Word Search II: Find Many Words in a Grid with a Trie and BacktrackingTreesHardcodingLeetCode (opens in a new tab)
145Convert Sorted Array to BST: Pick the Middle, Recurse on HalvesBSTEasycodingLeetCode (opens in a new tab)
146Validate Binary Search Tree: Bounds Recursion and Inorder CheckBSTMediumcodingLeetCode (opens in a new tab)
147Kth Smallest Element in a BST: Inorder Traversal with Early StopBSTMediumcodingLeetCode (opens in a new tab)
148Lowest Common Ancestor of a BST: Follow the Split PointBSTMediumcodingLeetCode (opens in a new tab)
149Insert into a BST: Walk Down to the Empty SpotBSTMediumcodingLeetCode (opens in a new tab)
150Delete Node in a BST: Leaf, One Child and Two Children CasesBSTMediumcodingLeetCode (opens in a new tab)
151Kth Largest Element in a Stream: Size-k Min-HeapHeapEasycodingLeetCode (opens in a new tab)
152Last Stone Weight: Simulating Smashes with a Max-HeapHeapEasycodingLeetCode (opens in a new tab)
153Top K Frequent Elements: Return the k Most Common ValuesHeapMediumcodingLeetCode (opens in a new tab)
154K Closest Points to Origin: Bounded Max-Heap and QuickselectHeapMediumcodingLeetCode (opens in a new tab)
155Kth Largest Element in an Array: Heap, Quickselect and CountingHeapMediumcodingLeetCode (opens in a new tab)
156Task Scheduler: Cooldowns with a Max-Heap or a Counting FormulaHeapMediumcodingLeetCode (opens in a new tab)
157Min Cost to Connect Ropes: Always Join the Two ShortestHeapMediumcodingGeeksforGeeks (opens in a new tab)
158Sort Characters By Frequency: Count, Then Order by a Heap or BucketsHeapMediumcodingLeetCode (opens in a new tab)
159Find K Closest Elements: Binary Search for the Best WindowHeapMediumcodingLeetCode (opens in a new tab)
160Reorganize String: Place the Most Frequent Character First, Never Twice in a RowHeapMediumcodingLeetCode (opens in a new tab)
161Maximum Frequency Stack: Pop the Most Frequent Value in O(1)HeapHardcoding, architectureLeetCode (opens in a new tab)
162Maximum Sum Combination: The K Largest Pair Sums with a Max-HeapHeapMediumcodingGeeksforGeeks (opens in a new tab)
163Find Median from Data Stream: Two Heaps Kept in BalanceHeapHardcodingLeetCode (opens in a new tab)
164Sliding Window Median: Two Heaps with Lazy DeletionHeapHardcodingLeetCode (opens in a new tab)
165IPO: Maximise Capital by Picking the Best Affordable Project Each RoundHeapHardcodingLeetCode (opens in a new tab)
166Design Twitter: News Feed with a K-Way Heap MergeHeapMediumcoding, architectureLeetCode (opens in a new tab)
167Merge k Sorted Lists: Min-Heap and Divide-and-Conquer SolutionsHeapHardcodingLeetCode (opens in a new tab)
168Smallest Range Covering Elements from K Lists: K-Way Merge with a Min-HeapHeapHardcodingLeetCode (opens in a new tab)
169Jump Game: Can You Reach the Last Index? Greedy Furthest ReachGreedyMediumcodingLeetCode (opens in a new tab)
170Jump Game II: Fewest Jumps to the End with Greedy Level-by-Level BFSGreedyMediumcodingLeetCode (opens in a new tab)
171Gas Station: Find the Start of a Circular Route in One Greedy PassGreedyMediumcodingLeetCode (opens in a new tab)
172Hand of Straights: Group Cards into Consecutive Runs GreedilyGreedyMediumcodingLeetCode (opens in a new tab)
173Merge Triplets to Form Target: Keep Only Triplets That Never OvershootGreedyMediumcodingLeetCode (opens in a new tab)
174Partition Labels: Split a String So Each Letter Stays in One PartGreedyMediumcodingLeetCode (opens in a new tab)
175Valid Parenthesis String: Track a Range of Open Counts GreedilyGreedyMediumcodingLeetCode (opens in a new tab)
176Maximum Length of Pair Chain: Greedy by Earliest EndGreedyMediumcodingLeetCode (opens in a new tab)
177Minimum Add to Make Parentheses Valid: Count Unmatched Brackets in One PassGreedyMediumcodingLeetCode (opens in a new tab)
178Remove Duplicate Letters: Smallest Order with a Greedy Monotonic StackGreedyMediumcodingLeetCode (opens in a new tab)
179Meeting Rooms: Check Whether One Person Can Attend Every MeetingGreedyEasycodingGeeksforGeeks (opens in a new tab)
180Merge Intervals: Combine Every Overlapping RangeGreedyMediumcodingLeetCode (opens in a new tab)
181Insert Interval: Add a Range to a Sorted List and Merge OverlapsGreedyMediumcodingLeetCode (opens in a new tab)
182Non-overlapping Intervals: Fewest Removals to Eliminate OverlapsGreedyMediumcodingLeetCode (opens in a new tab)
183Interval List Intersections: Two Pointers over Sorted RangesGreedyMediumcodingLeetCode (opens in a new tab)
184Meeting Rooms II: Count the Rooms with a Min-Heap or a Sweep LineGreedyMediumcodingGeeksforGeeks (opens in a new tab)
185My Calendar I: Accept Bookings Only When They Do Not OverlapGreedyMediumcodingLeetCode (opens in a new tab)
186Generate Parentheses: List Every Balanced String of n PairsBacktrackingMediumcodingLeetCode (opens in a new tab)
187Subsets: Generate the Power Set with Include/Exclude BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
188Permutations: Every Ordering of Distinct Values with BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
189Subsets II: Power Set Without Duplicates When Values RepeatBacktrackingMediumcodingLeetCode (opens in a new tab)
190Letter Combinations of a Phone Number: Cartesian Product by BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
191Letter Case Permutation: Branch Twice on Every LetterBacktrackingMediumcodingLeetCode (opens in a new tab)
192Combination Sum: Reach a Target with Reusable Values via BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
193Combination Sum II: Use Each Value Once and Avoid Duplicate AnswersBacktrackingMediumcodingLeetCode (opens in a new tab)
194Word Search: Trace a Word Through a Letter Grid with DFS BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
195Palindrome Partitioning: Split a String into Palindromes by BacktrackingBacktrackingMediumcodingLeetCode (opens in a new tab)
196N-Queens: Place Non-Attacking Queens Row by Row with BacktrackingBacktrackingHardcodingLeetCode (opens in a new tab)
197Sudoku Solver: Backtracking with Constraint Sets and Smart Cell ChoiceBacktrackingHardcodingLeetCode (opens in a new tab)
198Find if Path Exists in Graph: Reachability with BFS or Union-FindGraphEasycodingLeetCode (opens in a new tab)
199Clone Graph: Deep-Copy a Connected Graph with a Hash Map and BFS or DFSGraphMediumcodingLeetCode (opens in a new tab)
200Number of Provinces: Count Components in an Adjacency MatrixGraphMediumcodingLeetCode (opens in a new tab)
201Word Ladder: Shortest Word Transformation with BFS and Wildcard BucketsGraphHardcodingLeetCode (opens in a new tab)
202Reconstruct Itinerary: Eulerian Path with Hierholzer's AlgorithmGraphHardcodingLeetCode (opens in a new tab)
203Flood Fill: Repaint a Connected Region with DFS or BFSGraphEasycodingLeetCode (opens in a new tab)
204Island Perimeter: Count Land Edges Without a TraversalGraphEasycodingLeetCode (opens in a new tab)
205Number of Islands: Count Connected Land Cells with BFS, DFS or Union-FindGraphMediumcodingLeetCode (opens in a new tab)
206Max Area of Island: Largest Connected Land Region with Flood FillGraphMediumcodingLeetCode (opens in a new tab)
207Pacific Atlantic Water Flow: Reverse Multi-Source BFS from Both OceansGraphMediumcodingLeetCode (opens in a new tab)
208Surrounded Regions: Capture Enclosed Cells by Flood-Filling from the BorderGraphMediumcodingLeetCode (opens in a new tab)
209Rotting Oranges: Minutes to Spread via Level-by-Level Multi-Source BFSGraphMediumcodingLeetCode (opens in a new tab)
210Number of Closed Islands: Sink the Border, Then CountGraphMediumcodingLeetCode (opens in a new tab)
211Course Schedule: Detect a Cycle in a Prerequisite Graph with Kahn's AlgorithmGraphMediumcodingLeetCode (opens in a new tab)
212Course Schedule II: Return a Valid Course Order with Topological SortGraphMediumcodingLeetCode (opens in a new tab)
213Topological Sort: Order a DAG with Kahn's Algorithm or DFSGraphMediumcodingGeeksforGeeks (opens in a new tab)
214Minimum Height Trees: Trim Leaves Until the Centre RemainsGraphMediumcodingLeetCode (opens in a new tab)
215Alien Dictionary: Derive a Letter Order from Sorted Words with Topological SortGraphHardcodingGeeksforGeeks (opens in a new tab)
216Graph Valid Tree: Check Edge Count, Connectivity and Cycles with Union-FindGraphMediumcodingGeeksforGeeks (opens in a new tab)
217Number of Connected Components in an Undirected Graph with Union-FindGraphMediumcodingGeeksforGeeks (opens in a new tab)
218Redundant Connection: Find the Edge That Closes a Cycle with Union-FindGraphMediumcodingLeetCode (opens in a new tab)
219Is Graph Bipartite?: Two-Colour Every ComponentGraphMediumcodingLeetCode (opens in a new tab)
220Path With Minimum Effort: Minimise the Largest Step on a GridGraphMediumcodingLeetCode (opens in a new tab)
221Network Delay Time: Single-Source Shortest Paths with Dijkstra's AlgorithmGraphMediumcodingLeetCode (opens in a new tab)
222Cheapest Flights Within K Stops: Bounded Bellman-Ford for Limited HopsGraphMediumcodingLeetCode (opens in a new tab)
223Min Cost to Connect All Points: Minimum Spanning Tree with Prim or KruskalGraphMediumcodingLeetCode (opens in a new tab)
224Swim in Rising Water: Minimax Path with a Modified DijkstraGraphHardcodingLeetCode (opens in a new tab)
225Climbing Stairs: Count Ways with a Fibonacci-Style DPDynamic ProgrammingEasycodingLeetCode (opens in a new tab)
226Min Cost Climbing Stairs: Cheapest Path to the Top with 1D DPDynamic ProgrammingEasycodingLeetCode (opens in a new tab)
227House Robber: Maximum Non-Adjacent Sum with Take-or-Skip DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
228House Robber II: Non-Adjacent Maximum Sum When Houses Form a CircleDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
229Decode Ways: Count Digit-to-Letter Decodings with Prefix DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
230Coin Change: Fewest Coins with Bottom-Up DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
231Word Break: Can a String Be Split into Dictionary Words? Prefix DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
232Longest Increasing Subsequence: O(n^2) DP and O(n log n) Patience SortingDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
233Best Time to Buy and Sell Stock with Cooldown: State-Machine DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
234Partition Equal Subset Sum: 0/1 Knapsack on Half the TotalDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
235Coin Change II: Count Combinations That Make an AmountDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
236Target Sum: Count Sign Assignments with Subset-Sum DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
2370 - 1 Knapsack Problem: Take or Skip Each Item OnceDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
238Subset Sum Problem: Track Every Reachable TotalDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
239Count Subsets with Sum: Add Up the Ways, Not Just True or FalseDynamic ProgrammingMediumcodingGeeksforGeeks (opens in a new tab)
240Partition Into 2 Subsets with Min Sum Diff: Subset Sum Up to Half the TotalDynamic ProgrammingHardcodingGeeksforGeeks (opens in a new tab)
241Longest Palindromic Substring: Expand Around Centres or Interval DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
242Palindromic Substrings: Count Every Palindrome by Expanding Around CentresDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
243Unique Paths: Count Grid Routes with 2D DP or a Binomial CoefficientDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
244Longest Common Subsequence: The Classic Two-String DP TableDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
245Interleaving String: Can Two Strings Merge into a Third? 2D DPDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
246Edit Distance: Levenshtein Distance with a 2D DP TableDynamic ProgrammingMediumcodingLeetCode (opens in a new tab)
247Burst Balloons: Interval DP by Choosing the Last Balloon to BurstDynamic ProgrammingHardcodingLeetCode (opens in a new tab)
248Regular 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