Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
31 votes

Suppose that a robot is placed on the Cartesian plane. At each step it is allowed to move either one unit up or one unit right, i.e., if it is at $(i,j)$ then it can move to either $(i + 1, j)$ or $(i,j + 1)$.

How many distinct paths are there for the robot to reach the point $(10,10)$ starting from the initial position $(0,0)$?

  1. $^{20}\mathrm{C}_{10}$
  2. $2^{20}$
  3. $2^{10}$
  4. None of the above
in Combinatory
edited by
I am not able to solve question 85 even by referring the solution many times. Kindly, explain in detail. U are asking to subtract some paths and u are multiplying. Plz help me.

Very nice explanation 

It's the same thing that I did missed it by last step :( thanks though

from 9:20

6 Answers

70 votes
Best answer

In ques given, $r = \text{Move Right}$ and $u = \text{Move Up}$
so using ${10}$ combination of $r$ and ${10}$ combinations of $u$ moves we get a solution.

Convert the graphical moves to text and one such solution we get,

$= \{u, u, u, u, u, u, u, u, u, u, r, r, r, r, r, r, r, r, r, r\}$

now all possible arrangements of them is given by $= \frac{20!}{10! \times 10!} = {20 \choose 10}.$

Hence, option A is true.

edited by


Can you give intuitive explanation for why Option C is incorrect ?

I calculated it & Realized Option C gives very less movement. I've understood how option D is correct, though I just want to know why option C is incorrect !

I've tried this on few small examples & I realized that by breaking one path, we are reducing total no of paths to destination by big factor, I think it is because there are lot of paths going through every move. Though if you can explain it more intituively that'll be great !


how are you getting option C

provide your solution.

I'm not saying Option C. What I'm saying is, how we are exactly reducing no of choices, by breaking one of up-right link ! I think it might be because of there are lot of choices even after that link.. That may be it, Just was confused little bit !
Suppose if we are allowed to take 2 steps up and 2 steps right. Then we need 5 steps of U and 5 steps of R. Then the answer should be $\frac{20!}{5! * 5!}$.

Please correct me if I am wrong.
"Suppose if we are allowed to take 2 steps up and 2 steps right. Then we need 5 steps of U and 5 steps of R. Then the answer should be 20!/(5! * 5!)"

Is this approach given by @rohan mishra correct???
good explanation
It will be 10!/5!*5!

@amarVashishth sir nice explanation.

I approached this in similar manner .

As to reach diagonal elements we need both up moves and right moves as well ( and drawing for smaller example gives us clearer picture like from (0,0) to (1,1) or or till (2,2) ) 

Now from small example it is clear that we need equal amount of up and right moves and then we can finally apply the formula of possible arrangements (with repitition) and get the answer. 


P.S.-> I know Guess work is a bad thing ,but after seeing option my mind was convinced that option (b) and (c) are not possible because of their large magnitude compared to first option.

17 votes

This answer is not directly related to the QS But this may help to view this problem in a recursive way.

How many ways we can traverse this grid from $(0,0)$ to $(5,5)$.

Allowed moves from a cell are:

  1. Left to right by $1$ unit.
  2. Top to Bottom by $1$ unit.

This problem has $O(1)$ solution.

But we will see how we can use top-down recursion and memoization to calculate that value.

Currently, we have a problem size of $(6,6)$ i.e we have still to cover a $6^*6$ grid and we are at cell $(0,0)$.

Let's say we are at cell $(1,2)$ somehow.

Now, this situation we have a $4^*5$ grid to traverse. What are the steps we can take in this cell or in this state ?

Well two things can be done.

  1. Go right 
  2. Go down.

If we move right, then we will have to traverse a smaller grid of size $3^*5$

And if we move down, we will have to traverse a different smaller grid of size $4^*4$.

So, what we have seen is that from a bigger size problem of $4^*5$ grid we can arrive at smaller grid size problem by applying two different steps.

And if we sum up the two smaller subproblem solution we can get the result of bigger problem solution. (which was of size $4^*5$ ).

Therefore  $\text{solution}(m,n) = \text{solution}(m-1,n) + \text{solution}(m,n-1)$, this is the recursion and the Top Down approach will seek for solution of $(m,n)$ without knowing the solution of $(m-1,n)$ and $(m.n-1)$. Using recursion we will recurse towards smaller and smaller sub problem untill we hit in some base case.

And the base here is:

When we arrive at cell $(5,5)$. In this state, we have arrived at the destination and there nothing to do now, and how many ways to go from $(5,5)$ to $(5,5)$. It is equal to $1$ ( means don't move in this particular case).

Therefore  $ \text{solution}(1,1)$ $= 1$.

To speed up the solution and not repeating same sub problem, again and again, we will use memoization table.

Here is the code:

#define MAX_X 6
#define MAX_Y 8
int dp[MAX_X+1][MAX_Y+1];
int solve(int m,int n) {
  if(dp[m][n] != -1) return dp[m][n];
  int res = 0; 
  if(m > 1) res += solve(m-1,n);
  if(n > 1) res += solve(m,n-1);
  return dp[m][n] = res;
int main() {
  for(int i=0;i<(MAX_X+1);i++)
    for(int j=0;j<(MAX_Y+1);j++)
      dp[i][j] = -1;
  dp[1][1] = 1;
  int m = MAX_X,n = MAX_Y;
  return 0;

Superb. thanks :-)

ur explanations r damn too gd ....
7 votes

84 At each move, robot can move either 1 unit right, or 1 unit up, and there will be 20 such moves required to reach (10,10) from (0,0). So we have to divide these 20 moves, numbered from 1 to 20, into 2 groups : right group and up group. Right group contains those moves in which we move right, and up group contains those moves in which we move up. Each group contains 10 elements each. So basically, we have to divide 20 things into 2 groups of 10 10 things each, which can be done in 20!/(10! ☓10!)=20C10 ways. So option (A) is correct.

edited by

This is unordered partition hence ,should not it be 20!/((10!*10!)*2!) ?

No, it is not because the order of steps in each group have to be specific. For e.g. an up move from y=0 to y=1 has to appear before the up move from y=1 to y=2 which in turn has to come before further up moves. Similarly it can be inferred for x moves.

Secondly, logic here is to place moves from each group in their specific order into the available 20 choices. Ordering of the groups themselves need not be considered.
3 votes
The answer for 84 is A. It is same as selecting 10 out of 20 elements.

20C10 or 210?

It is 20 C 10.
3 votes

@amarvashishth has given nice explanation, but if you want to visualize how it does work then draw 2x2 grid and try to draw all path from (0,0) to (2,2) you can easily see how it does work and you also can verify answer for 10X10

here it give 4C2  =6  // { R,R,U,U} any path you follow you will encounter only two up and two right which is 4! /(2!*2!)

edited by
0 votes
In order to move from (0,0) to (10,10)there will be total 20 movement out of which there will be 10 right,10 upward movement combination

so 20!/10!.10!= c(20,10)

Related questions

26 votes
4 answers
Suppose that a robot is placed on the Cartesian plane. At each step it is allowed to move either one unit up or one unit right, i.e., if it is at $(i,j)$ then it can move to either $(i + 1, j)$ or $(i,j + 1)$ ... $^{20}\mathrm{C}_{10} - ^{8}\mathrm{C}_{4}\times ^{11}\mathrm{C}_{5}$
asked Apr 23, 2016 in Combinatory jothee 3k views
26 votes
4 answers
What is the maximum number of different Boolean functions involving $n$ Boolean variables? $n^2$ $2^n$ $2^{2^n}$ $2^{n^2}$
asked Sep 22, 2014 in Set Theory & Algebra Kathleen 2.9k views
42 votes
15 answers
Consider the following segment of C-code: int j, n; j = 1; while (j <= n) j = j * 2; The number of comparisons made in the execution of the loop for any $n > 0$ is: $\lceil \log_2n \rceil +1$ $n$ $\lceil \log_2n \rceil$ $\lfloor \log_2n \rfloor +1$
asked Jul 6, 2016 in Algorithms Arjun 13.1k views
25 votes
3 answers
Consider the following program segment. Here $\text{R1, R2}$ and $\text{R3}$ ... interrupt occurs during the execution of the instruction INC R3 , what return address will be pushed on to the stack? $1005$ $1020$ $1024$ $1040$
asked Apr 23, 2016 in CO and Architecture jothee 4.4k views