DSA Crash Course
Advanced Algorithms

Advanced Algorithms — Overview

Mark when done:

Phase 5 — Advanced Algorithms (Days 49-56)

Goal: Cover the four advanced topic clusters that show up in senior / FAANG interviews: advanced DP variants, math & bit manipulation, string algorithms, and interval algorithms.

Pre-req: Phase 2 DP and Phase 4 advanced data structures.

What You'll Cover

#ModuleDaysWhy it's here
5.1Advanced DP49-50Bitmask DP, DP on Trees (House Robber III), LIS in O(n log n), Interval DP. The DP variants that don't fit the 1D / 2D-grid templates from Phase 2.
5.2Math & Bit Manipulation51-52XOR identity, fast exponentiation, bit counting, integer overflow handling. Easy points in interviews — and the quickest knowledge gap to close.
5.3String Algorithms55-56 (optional)KMP, Z-function, Rabin-Karp. Skim the concepts; do at least one KMP problem.
5.4Intervals53-54Merge / insert / non-overlapping / arrows / intersections. The interval-merging template solves all five with minor variations.

How to Use This Phase

Phase 5 is broad and shallow by design. You are not expected to master every variant — you are expected to recognise them so you don't freeze in an interview. For each module:

  1. Read the README's worked example.
  2. Solve 1-2 problems to lock in the recipe.
  3. If you struggle, add the topic to your redo queue and revisit weekly.

The most common mistake in Phase 5 is treating it like Phase 1 ("must master every problem"). Don't. Get acquainted with each topic; deep-dive only the ones your target companies are known to ask.

What's Critical vs What's Optional

TopicFor Google / MetaFor most other companies
Advanced DP (Bitmask, DP on Trees)RequiredOptional
Math & Bit ManipulationRequired (esp. Sum of Two Integers, Pow(x, n))Required (Single Number is universal)
IntervalsRequiredRequired
String Algorithms (KMP, Z-function)Often requiredSkim only

External Resources (Hand-Picked Supplements)