Reaching (n,n) from (0,0) in minimum steps using only horizontal and vertical steps without crossing line y=x

132 Views Asked by At

I have a square grid having $2n+1$ horizontal equidistant lines and $2n+1$ vertical equidistant line making smallest possible unit of a square with side $1×1$ .

Now the question is to reach $(n,n)$ from $(0,0)$ in minimum steps and by only walking on lines (means only in horizontal or vertical direction ) without crossing the line $y=x$ . I am thinking as that suppose we have n number of $V$ (denoting vertical step) and n number of &$H$ (denoting horizontal steps ) . Now we have to arrange them such that before every $K^\text{th}$ step ($K \in [1,n]$) either number of horizontal steps is greater than vertical steps or vice versa . I can think that if 1st step is horizontal than last should be vertical or if 1st step is vertical than last must be horizontal and but do not have any idea how to arrange intermediate straps. Please help

1

There are 1 best solutions below

0
On BEST ANSWER

The number of paths from (0,0) to (n,n) without crossing the diagonal is given by the Catalan number

$$C_n = \frac{1}{n+1} \binom{2n}{n}$$

The Wikipedia link above gives several proofs of this formula; the second and third proofs directly relate to the question you're asking.