Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

A robot moves from the top-left to the bottom-right of a 4 × 5 grid of cells, each step going right, down, or diagonally down-right. How many such paths exist?

  1. A. 41
  2. B. 146
  3. C. 129
  4. D. 35

Correct answer: C. 129

Each cell's count is the sum of the three predecessors (above, left, and above-left diagonal). Counting only right and down moves gives C(R+C−2, R−1), which is a different count.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic