Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Stage 13 — 1-D Dynamic Programming
# 1-D Dynamic Programming

Dynamic programming is the technique of breaking a problem into overlapping subproblems, solving each once, and storing the result to avoid recomputation. In one-dimensional DP, each state depends only on a fixed number of previous states, so the solution builds a single array from left to right. The first step is always identifying the recurrence: what does the answer at position i depend on? The problems here cover the core DP patterns you will see repeatedly: linear sequences, knapsack decisions, and string segmentation. DP problems are notoriously hard to recognize, and the only reliable way to get better at them is to solve many and study the structure of their recurrences.
Dynamic programming is the technique of breaking a problem into overlapping subproblems, solving each once, and storing the result to avoid recomputation. In one-dimensional DP, each state depends only on a fixed number of previous states, so the solution builds a single array from left to right. The first step is always identifying the recurrence: what does the answer at position i depend on? The problems here cover the core DP patterns you will see repeatedly: linear sequences, knapsack decisions, and string segmentation. DP problems are notoriously hard to recognize, and the only reliable way to get better at them is to solve many and study the structure of their recurrences.

Visit the following resources to learn more:

- [@article@1-D Dynamic Programming Problem](https://www.scaler.com/topics/data-structures/1-d-dynamic-programming-problem/)
- [@video@5 Simple Steps for Solving Dynamic Programming Problems](https://www.youtube.com/watch?v=aPQY__2H3tE)
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Stage 14 — 2-D Dynamic Programming
# 2-D Dynamic Programming

Two-dimensional DP extends the same ideas to problems where the state depends on two variables simultaneously, typically two indices into two sequences or two dimensions of a grid. The table is now a matrix, and each cell is filled based on cells above it, to its left, or diagonally adjacent. The problems here include string comparison (edit distance, longest common subsequence), grid path counting, and interval DP where you think about ranges rather than prefixes. These problems tend to be harder to set up than 1-D DP, but once you identify the state and the transition, the code follows directly from the recurrence.
Two-dimensional DP extends the same ideas to problems where the state depends on two variables simultaneously, typically two indices into two sequences or two dimensions of a grid. The table is now a matrix, and each cell is filled based on cells above it, to its left, or diagonally adjacent. The problems here include string comparison (edit distance, longest common subsequence), grid path counting, and interval DP where you think about ranges rather than prefixes. These problems tend to be harder to set up than 1-D DP, but once you identify the state and the transition, the code follows directly from the recurrence.

Visit the following resources to learn more:

- [@video@Learn Dynamic Programming with Animations – Full Course for Beginners](https://www.youtube.com/watch?v=66hDgWottdA)
- [@video@Dynamic Programming 2D - Full Course - Python](https://www.youtube.com/watch?v=qMky6D6YtXU)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3Sum

Given an array of integers, find all unique triplets that sum to zero. You sort the array first, then for each element use two pointers to find pairs that complete the triplet. The sort plus two pointers bring it from O(n³) to O(n²). This problem teaches you to extend the two pointer technique beyond pairs and introduces how sorting enables smarter traversal. Visit the question on the LeetCode [website](https://leetcode.com/problems/3sum/).
Given an array of integers, find all unique triplets that sum to zero. You sort the array first, then for each element use two pointers to find pairs that complete the triplet. The sort plus two pointers bring it from O(n³) to O(n²). This problem teaches you to extend the two pointer technique beyond pairs and introduces how sorting enables smarter traversal.

Visit the following resources to learn more:

- [@article@3Sum - LeetCode](https://leetcode.com/problems/3sum/description/)
- [@video@3Sum (Updated Solution)](https://www.youtube.com/watch?v=TBePcj8DgxM)
- [@video@3 Sum (LeetCode 15)](https://www.youtube.com/watch?v=cRBSOz49fQk&t=39s)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Stage 12 — Advanced Graphs
# Advanced Graphs

Advanced graph problems involve weighted edges, which require more sophisticated algorithms than simple BFS or DFS. Dijkstra's algorithm finds the shortest path in a weighted graph using a min-heap. Prim's and Kruskal's algorithms find the minimum spanning tree, connecting all nodes at minimum total cost. These algorithms are more complex than anything seen so far, and the problems here often combine the algorithm with an additional constraint, such as a limit on the number of steps or a non-standard cost function. Understanding the conditions under which each algorithm applies is as important as knowing how to implement it.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Stage 1 — Arrays & Hashing
# Arrays & Hashing

Arrays and hash maps are the building blocks of almost every algorithm problem. Before learning any pattern, you need to be comfortable navigating an array and reaching for a hash map when you need fast lookups. Most problems in this stage are solved in one or two passes, and the main skill you are developing is recognizing when a hash map can replace a nested loop. If you find yourself thinking about checking membership or counting frequencies, a hash map is almost always the right tool.
Arrays and hash maps are the building blocks of almost every algorithm problem. Before learning any pattern, you need to be comfortable navigating an array and reaching for a hash map when you need fast lookups. Most problems in this stage are solved in one or two passes, and the main skill you are developing is recognizing when a hash map can replace a nested loop. If you find yourself thinking about checking membership or counting frequencies, a hash map is almost always the right tool.

Visit the following resources to learn more:

- [@article@DSA Arrays](https://www.w3schools.com/dsa/dsa_data_arrays.php)
- [@article@DSA Hash Tables](https://www.w3schools.com/dsa/dsa_theory_hashtables.php)
- [@article@Learning Data Structures](https://medium.com/@ashissh.dev/learning-data-structures-arrays-and-hash-tables-6ced329a9189)
- [@video@Ep.1 - Arrays & Hashing](https://www.youtube.com/watch?v=nET1jqI_Ntk)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Stage 9 — Backtracking
# Backtracking

Backtracking is a systematic way to explore all possible solutions by making a choice, recursing, and undoing the choice when you backtrack. It is the right tool for problems that ask for all combinations, all permutations, all subsets, or any valid configuration. The key skill is recognizing when to prune: stopping a branch early when you can tell it cannot lead to a valid solution. Without pruning, backtracking is just brute force. Most problems here share the same recursive skeleton and differ only in the constraints that determine valid choices and stopping conditions.
Backtracking is a systematic way to explore all possible solutions by making a choice, recursing, and undoing the choice when you backtrack. It is the right tool for problems that ask for all combinations, all permutations, all subsets, or any valid configuration. The key skill is recognizing when to prune: stopping a branch early when you can tell it cannot lead to a valid solution. Without pruning, backtracking is just brute force. Most problems here share the same recursive skeleton and differ only in the constraints that determine valid choices and stopping conditions.

Visit the following resources to learn more:

- [@article@Backtracking Overview](https://www.hellointerview.com/learn/code/backtracking/overview)
- [@video@Backtracking Algorithm in 120 Seconds](https://www.youtube.com/watch?v=RtpJOGvfo7E)
- [@video@Introduction to Backtracking - Brute Force Approach](https://www.youtube.com/watch?v=DKCbsiDBN6c)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Best Time to Buy and Sell Stock

Given an array of daily stock prices, find the maximum profit from one buy and one sell. You track the minimum price seen so far and the best profit achievable at each step using a single pass. This is the simplest sliding window problem since the window always expands from the current day, and it teaches you how to track a running minimum and maximum simultaneously. Visit the question on the LeetCode [website](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/).
Given an array of daily stock prices, find the maximum profit from one buy and one sell. You track the minimum price seen so far and the best profit achievable at each step using a single pass. This is the simplest sliding window problem since the window always expands from the current day, and it teaches you how to track a running minimum and maximum simultaneously.

Visit the following resources to learn more:

- [@article@Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
- [@video@LeetCode Best Time to Buy and Sell Stock Solution](https://www.youtube.com/watch?v=3RHCb8LY-X4)
- [@video@Best Time to Buy and Sell Stock](https://www.youtube.com/watch?v=kJZrMGpyWpk)
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Stage 4 — Binary Search
# Binary Search

Binary search is not just for finding an element in a sorted array. It is a general technique for eliminating half the search space at each step, and it applies whenever you can define a condition that splits possible answers into a valid half and an invalid half. The problems in this stage move from the textbook version to more creative applications: searching in rotated arrays, and binary searching on the answer itself rather than on the input. Getting binary search right under pressure, with correct boundary conditions, is a skill that requires deliberate practice.
Binary search is not just for finding an element in a sorted array. It is a general technique for eliminating half the search space at each step, and it applies whenever you can define a condition that splits possible answers into a valid half and an invalid half. The problems in this stage move from the textbook version to more creative applications: searching in rotated arrays, and binary searching on the answer itself rather than on the input. Getting binary search right under pressure, with correct boundary conditions, is a skill that requires deliberate practice.

Visit the following resources to learn more:

- [@article@Binary Search](https://www.w3schools.com/dsa/dsa_algo_binarysearch.php)
- [@video@Binary Search Algorithm in 100 Seconds](https://www.youtube.com/watch?v=MFhxShGxHWc)
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Binary Search

Given a sorted array and a target, return the index of the target or -1 if not found. You repeatedly halve the search space by comparing the middle element to the target. This is the simplest form of binary search and the one you must be able to write without mistakes before moving to harder variants. Visit the question on the LeetCode [website](https://leetcode.com/problems/binary-search/).
Given a sorted array and a target, return the index of the target or -1 if not found. You repeatedly halve the search space by comparing the middle element to the target. This is the simplest form of binary search and the one you must be able to write without mistakes before moving to harder variants.

Visit the following resources to learn more:

- [@article@Binary Search](https://leetcode.com/problems/binary-search/)
- [@video@Binary Search | Leet code 704 | Theory explained + Python code](https://www.youtube.com/watch?v=B7lMQIcIyN4)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Binary Tree Level Order Traversal

Given a binary tree, return its node values level by level. You use a queue to process all nodes at one level before moving to the next, collecting each level into its own list. This is the entry point for tree BFS and teaches you the queue-based level tracking pattern that applies to many tree and graph problems. Visit the question on the LeetCode [website](https://leetcode.com/problems/binary-tree-level-order-traversal/).
Given a binary tree, return its node values level by level. You use a queue to process all nodes at one level before moving to the next, collecting each level into its own list. This is the entry point for tree BFS and teaches you the queue-based level tracking pattern that applies to many tree and graph problems.

Visit the following resources to learn more:

- [@article@Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)
- [@video@Binary Tree Level Order Traversal | Live Coding with Explanation](https://www.youtube.com/watch?v=vQrggrFMyp8)
- [@video@Binary Tree Level Order Traversal (BFS)](http://youtube.com/watch?v=2_tm34ZtYT4)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Binary Tree Maximum Path Sum

Given a binary tree where nodes can have negative values, find the maximum sum of any path between any two nodes. At each node you decide whether to extend either child's path or start fresh, tracking the global maximum as you go. This is one of the hardest tree DFS problems and teaches you to separate what you return up the recursion from what you record as your answer. Visit the question on the LeetCode [website](https://leetcode.com/problems/binary-tree-maximum-path-sum/).
Given a binary tree where nodes can have negative values, find the maximum sum of any path between any two nodes. At each node you decide whether to extend either child's path or start fresh, tracking the global maximum as you go. This is one of the hardest tree DFS problems and teaches you to separate what you return up the recursion from what you record as your answer.

Visit the following resources to learn more:

- [@article@Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/)
- [@video@Binary Tree Maximum Path Sum - LeetCode 124 - Python](https://www.youtube.com/watch?v=cfn-G-7vVlo)
- [@video@LeetCode 124. Binary Tree Maximum Path Sum](https://www.youtube.com/watch?v=mOdetMWwtoI)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Stage 17 — Bit Manipulation
# Bit Manipulation

Bit manipulation uses the binary representation of integers directly through bitwise operators: AND, OR, XOR, and shifts. It is useful for problems involving pairs, uniqueness, flags, or any situation where you need to extract or toggle individual bits. XOR is particularly powerful because it is its own inverse: XOR-ing a value twice cancels out. The problems here are mostly short, but they require a different way of thinking about numbers. Once you internalize the basic bit operations, you will start seeing where they can replace more expensive data structures in problems across other categories.
Bit manipulation uses the binary representation of integers directly through bitwise operators: AND, OR, XOR, and shifts. It is useful for problems involving pairs, uniqueness, flags, or any situation where you need to extract or toggle individual bits. XOR is particularly powerful because it is its own inverse: XOR-ing a value twice cancels out. The problems here are mostly short, but they require a different way of thinking about numbers. Once you internalize the basic bit operations, you will start seeing where they can replace more expensive data structures in problems across other categories.

Visit the following resources to learn more:

- [@article@Bit manipulation](https://cp-algorithms.com/algebra/bit-manipulation.html)
- [@video@Algorithms: Bit Manipulation](https://www.youtube.com/watch?v=NLKQEOgBAnw)
- [@video@Bitwise Operators and WHY we use them](https://www.youtube.com/watch?v=igIjGxF2J-w)
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Burst Balloons

Given an array of balloons with values, burst all of them to maximize coins, where bursting a balloon gives coins equal to the product of itself and its neighbors. You use interval DP: instead of choosing which balloon to burst first, you choose which to burst last within each interval. This problem teaches you that sometimes reversing the order of decisions makes the DP structure cleaner. Visit the question on the LeetCode [website](https://leetcode.com/problems/burst-balloons/).
Given an array of balloons with values, burst all of them to maximize coins, where bursting a balloon gives coins equal to the product of itself and its neighbors. You use interval DP: instead of choosing which balloon to burst first, you choose which to burst last within each interval. This problem teaches you that sometimes reversing the order of decisions makes the DP structure cleaner.

Visit the following resources to learn more:

- [@article@Burst Balloons](https://leetcode.com/problems/burst-balloons/)
- [@video@Minimum Number of Arrows to Burst Balloons](https://www.youtube.com/watch?v=lPmkKnvNPrw)
- [@video@Understand LeetCode 312. Burst Balloons in 6 minutes](https://www.youtube.com/watch?v=o3-PUPXiVfI)
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# C++

C++ is the language of choice for competitive programmers and is common in companies where raw performance matters, such as systems, gaming, or high-frequency trading. It has the fastest execution time of any commonly used interview language and gives you direct access to the standard template library, which includes a heap, set, map, and many other useful structures. The tradeoff is verbosity and the overhead of managing memory manually in some cases. If you are already proficient in C++, it is an excellent interview language. If you are starting from scratch, the learning curve is steep.
C++ is the language of choice for competitive programmers and is common in companies where raw performance matters, such as systems, gaming, or high-frequency trading. It has the fastest execution time of any commonly used interview language and gives you direct access to the standard template library, which includes a heap, set, map, and many other useful structures. The tradeoff is verbosity and the overhead of managing memory manually in some cases. If you are already proficient in C++, it is an excellent interview language. If you are starting from scratch, the learning curve is steep.

Visit the following resources to learn more:

- [@roadmap@Visit the Dedicated C++ Roadmap](https://roadmap.sh/cpp)
Loading