Monday, 12 November 2012

Move block in matrix

  Adjust the font size     Reset ↕
Question:
Given a m*n matrix and a person is sitting in (0,0) box, and he has to go to the (m-1,n-1) box of the matrix .And the person can only go to right or down box from its current box position . We need to find out the number of ways he can reach from start to destination box .



Solution:
He needs to take total 'm-1 down' + 'n-1 right' steps
Its classical Permutation and Combination problem.
Refer to theorem 3 on this page intmath.com/counting-probability/3-permutations.php
Hence ans = (m+n-2)! / ((m-1)!*(n-1)!)

POST YOUR OPINION IF YOU HAVE BETTER SOLUTION

Click Here To add Comment

Recent comments

Send Quick Massage

Name

Email *

Message *

Recent posts

Total Pageviews

204,323

Blog Archive