AlgoFrames

Fill the paths table

Warm-up · Trace the algorithm · about 5 min

Follow the path-counting table on a 3 × 3 grid with an obstacle at (1, 0). Answer each question before the step plays.

Example 1

Input:

{"rows":3,"cols":3,"walls":[[1,0]]}

Output:

3

Constraints

  • The trace uses the grid shown.
  • Moves go right or down only.

Learn the idea first: Grid DP: paths, minimum path sum, obstacles, a visual lesson.

More Grid DP: paths, minimum path sum, obstacles problems