Interview Questions

245. Given a MxN matrix, in how many ways can you go from top-left to bottom-right?

Microsoft Interview Questions and Answers


(Continued from previous question...)

245. Given a MxN matrix, in how many ways can you go from top-left to bottom-right?

Question:
Given a MxN matrix, in how many ways can you go from top-left to bottom-right?


maybe an answer:


we have to cover m+n-2 steps. on the m+n-2 th step we set on bottom right.
at each point in journey we have choice (down/rigth) both help us in covering the m+n-2 steps to destination.
now m and n may not be equal.
so we have 2 choices oonly for min(m,n) times ie 2**(less(m,n)) choices. After that we are stuck on a row or cloumn and we have singluar choice.
Henec correct answer is 2**(less(m,n))

(Continued on next question...)

Other Interview Questions