Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aptitude puzzle

Consider a point P(n,n) in the cartesian co-ordinate system. A robot has to start from the origin and reach this point. The only steps the robot can take are :

  • 1 unit right
  • 1 unit up.

How many different paths can the robot take to point P?

Is there an optimal path to point P? (Both up and right steps incur the same cost).

like image 860
Pritpal Avatar asked Feb 07 '26 00:02

Pritpal


1 Answers

The total number of paths is

(2n choose n)

since you must make n right steps and n up steps to end at the point (n,n), but the order in which you make the steps is irrelevant.

So there are 2n total steps, of which n are right and n are up. Choose the positions for the right steps in (2n choose n) ways, and the remaining steps must be up steps.

No path is better than any other since all paths use the same number of up and right steps (both n).

like image 178
PengOne Avatar answered Feb 08 '26 19:02

PengOne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!