Data Structures & AlgorithmsModerateCodeforces Div 2 · ICPC regional

5 × 4 grid, rows top to bottom ('#' = blocked, '.' = open): ..#. / ...# / ...# / ..#. / ..... Count the paths from top-left to bottom-right that move only RIGHT or DOWN and never enter a blocked cell. How many such paths exist?

  1. A. 5
  2. B. 6
  3. C. 16
  4. D. 20

Correct answer: A. 5

Counting right/down paths with DP gives 5; blocked cells contribute zero paths. Counting open cells instead of paths is a confusion of the two.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic