Data Structures & AlgorithmsHardTCS NQT · Product Company SDE

Problem: The grid 2×3 contains the values [[1,2,3],[4,5,6]]. From the top-left cell you move right or down to the bottom-right, collecting values along the way (start and end included). How many distinct paths yield a total of exactly 12?

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

Correct answer: A. 1

There are C(3,1) = 3 monotone paths; checking each total shows which ones collect exactly 12. Counting the paths alone, without summing the values, answers a different question.

More Coding Interview Problems questions

Exams that ask this topic