title: Incorrect result from dynamic programming algorithm
body: <p>I am trying to solve the Dynamic Problem question to find unique paths between origin and the last cell of a board. The problem is present on leetcode here <a href="https://leetcode.com/problems/unique-paths/" rel="nofollow noreferrer">https://leetcode.com/problems/unique-paths/</a>.</p>
  
  <p>The problem statement is - </p>
  
  <p>A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).</p>
  
  <p>The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).</p>
  
  <p>How many possible unique paths are there?</p>
  
  <p><strong>I am stuck on a test case with m = 23 and n = 12. Can you please explain the inconsistency in my code?</strong></p>
  
  <pre><code>    public int uniquePaths(int m, int n) {
          return getPath(m,n,1,1);
      }
  
      HashMap&lt;String,Integer&gt; map = new HashMap&lt;&gt;();
      private int getPath(int m, int n, int x, int y){
          if(x == n &amp;&amp; y == m) return 1;
          else if(x &gt; n || y &gt; m) return 0;
  
          String s = ""+x+y;
          if(map.get(s) != null) return map.get(s);
  
          int max =0;
          if(x &lt; n)
              max = max + getPath(m,n,x+1,y);
          if(y &lt; m)
              max = max + getPath(m,n,x,y+1);
  
          map.put(s,max);
          return max;
      }
  }
  </code></pre>
  
  <p>On m = 23 and n = 12, I am getting 192184665 as output whereas 193536720 is the expected result.</p>