aboutsummaryrefslogblamecommitdiffstats
path: root/62/main.js
blob: 922246209edaf91a51d1b3d45dff56629a7c0f79 (plain) (tree)
1
2
3
4
5
6
7
8







                                                                        
var uniquePaths = function (m, n, memo = {}) {
  const key = m + "," + n;
  if (key in memo) return memo[key];
  if (m === 1 && n === 1) return 1;
  if (m === 0 || n === 0) return 0;
  memo[key] = uniquePaths(m - 1, n, memo) + uniquePaths(m, n - 1, memo);
  return memo[key];
};