Data Structures & AlgorithmsModerateICPC regional · GATE CS top band

4 × 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. 14
  2. B. 5
  3. C. 6
  4. D. 16

Correct answer: B. 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