Section 05 · Stage 2: Master DSA
Problem Solving & Coding Patterns
A repeatable way to solve problems: complexity, recursion and the common patterns behind most coding questions.
What you will be able to do
- Follow a step-by-step method to go from a problem statement to working, tested code
- Work out the time and space complexity of your code and pick a target from the input limits
- Check your own solutions with hand-made test cases, a brute-force version and simple JUnit tests
- Recognise and apply two pointers, sliding window, prefix sums, hashing and binary search
- Write recursive and backtracking solutions and trace them on paper
- Use bit tricks and basic number theory that coding rounds expect
What you will learn
5.1How to Approach a Problem7 lessons
A repeatable routine for any coding question, so you never start by staring at a blank editor.
5.2Time & Space Complexity8 lessons
Analyse real code, not just labels, and use the input limits to know which solution will pass.
5.3Testing Your Solutions7 lessons
Catch wrong answers yourself before a judge does, with hand tests, a brute-force checker and a first look at JUnit.
5.4Array & String Techniques10 lessons
The everyday moves that most array and string questions are built from.
- Array traversal patterns25 min
- Dynamic arrays: how ArrayList grows30 min
- Reverse and rotate in place25 min
- Counting with arrays25 min
- Maximum subarray: Kadane's algorithm30 min
- Matrix traversal35 min
- Building strings efficiently25 min
- Parsing and cleaning text30 min
- Simulation problems30 min
- Practice: arrays and strings45 min
5.5Two Pointers9 lessons
Move two indexes through an array or string to replace a nested loop with one pass.
5.6Sliding Window9 lessons
Answer questions about subarrays and substrings by growing and shrinking a window instead of checking every range.
- The sliding window idea25 min
- Fixed-size windows22 min
- Variable-size windows26 min
- Longest substring without repeating characters25 min
- Windows with a count map28 min
- The at most k trick27 min
- Sliding window maximum28 min
- Real world: rate limits and moving averages24 min
- Practice: a reusable window template32 min
5.7Prefix Sums & Hashing9 lessons
Precompute running totals and use maps and sets to answer range and subarray questions fast.
5.8Binary Search9 lessons
Search sorted data in log n time, then use the same idea to search for the answer itself.
5.9Recursion in Depth8 lessons
Go beyond factorial: trace recursion trees, recurse on arrays and strings, and measure the cost of recursive code.
5.10Backtracking8 lessons
Build answers one choice at a time and undo choices that cannot work.
5.11Bit Manipulation & Math Basics10 lessons
Binary tricks and number theory that appear again and again in placement tests.
5.12Pattern Practice6 lessons
Mixed problems where you first decide which pattern fits, then solve and test it.
