Data Structures & AlgorithmsModerateTCS NQT Digital · Infosys

Problem: A matrix stores the number of paths in a 3×3 grid where each cell can be entered from the left or from above, and blocked cells contain 0. Blocked cells are (0,1) and (2,1). How many paths reach the bottom-right cell (2,2) from (0,0)?

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

Correct answer: D. 1

Path DP with blocked cells set to 0 by skipping them. A blocked cell in row 0 cuts off every route that would pass through it.

More Coding Interview Problems questions

Exams that ask this topic