title: Number of ways to move from Point 1 to Point 2 in a co-ordinate 2D plain
body: <p>I came across a question where it was asked to find the number of unique ways of reaching from point 1 to point 2 in a 2D co-ordinate plain.</p>
  
  <p>Note: This can be assumed without loss of generality that <code>x1 &lt; x2</code> and <code>y1 &lt; y2</code>.</p>
  
  <p>Moreover the motions are constrained int he following manner. One can move only right or up. means a valid move is from <code>(xa, ya)</code> to <code>(xb, yb)</code> if <code>xa &lt; xb</code> and <code>ya &lt; yb</code>.</p>
  
  <p>Mathematically, this can be found by <code>( [(x2-x1)+(y2-y1)]! ) / [(x2-x1)!] * [(y2-y1)!]</code>. I have thought of code too. </p>
  
  <p>I have approaches where I coded with dynamic programming and my approach takes around <code>O([max(x2,y2)]^2)</code> time and <code>Theta( x2 * y2 )</code> where I can just manage with the upper or lower triangular matrix.</p>
  
  <p>Can you think of some other approaches where running time is less than this? I am thinking of a recursive solution where the minimum running time is <code>O(max(x2,y2))</code>. </p>