Skip to main content

Unique Paths

Learn Unique Paths (Dynamic Programming, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Space-Optimized Unique Paths - O(cols) Instead of O(rows × cols) Since each row's DP values only depend on the PREVIOUS row (and the current row being built left to right), a single 1D array can be reused and updated in place - no need to store the whole 2D grid.

More lessons in Dynamic Programming