Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: A grid has 3 rows and 4 columns. Starting at (0,0), a move goes right or down, and cells with odd row+column are forbidden. How many valid paths reach (2,3)?

  1. A. 1
  2. B. 2
  3. C. 0
  4. D. 3

Correct answer: C. 0

Path DP where forbidden cells hold zero. Note that the target (2,3) has odd parity, so the answer is 0; this sanity check catches the trap of assuming the forbidden rule only applies to intermediate cells.

More Coding Interview Problems questions

Exams that ask this topic