Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

Count monotone lattice paths from (0, 0) to (3, 3) that move one step right (x+1) or up (y+1) and never touch a point (i, i) with 0 < i < 3. How many such paths are there?

  1. A. 4
  2. B. 8
  3. C. 20
  4. D. 2

Correct answer: A. 4

A valid path touches the diagonal only at its two endpoints, so it lies entirely on one side; each side is counted by a Catalan number C(n−1), and the two mirror families add up. The unrestricted count C(6, 3) = 20 includes paths that touch the diagonal.

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

Exams that ask this topic