Possible Duplicate:
How can I find the number of the shortest paths between two points on a 2D lattice grid?
If we have a point p(x,y) in coordinate system [x>=0, y>=0; i.e 1st quadrant]
How to find the number of ways of reaching the point from origin (0,0).
Ex: If p(2,1); way1: 0,0 -> 1,0 -> 2,0 -> 2,1 way2: 0,0 -> 1,0 -> 1,1 -> 2,1 way3: 0,0 -> 0,1 -> 1,1 -> 2,1
Is it possible to have a mathematical equation for it? and How? if we don't have, what's the best possible way to find those.
Rules:
- You can move only in horizontal, vertical directions (diagonal is not possible)
- you can only move to the point (a,b) such that 0<=a<=x and 0<=b<=y
- a, b can be only natural numbers