DP
initialize ways[][] m*atrix to zero*
*
*
*if 0,0 is blocked no solution else*
*ways[0][0] = 1*
*for i in range 1 to N-1  if ways[0][i] is not blocked ways[0][i] =
ways[0][i-1]*
*for i in range 1 to N-1  if ways[i][0] is not blocked ways[i][0] =
ways[i-1][0]*
*
*
*for i in range 1 to N-1*
*for j in range 1 to N-1*
*if i, j is not blocked*
*ways[i][j] = ways[i-1][j] + ways[i][j-1]*
*
*
*total no of ways are ways[N-1][N-1]*
-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to