classSolution { public: longlong num[110][110]; longlongdfs(int m, int n, int nowm, int nown) { if(nowm == m && nown == n) return1; if(num[nowm][nown]) return num[nowm][nown]; longlong sum = 0; if(nowm + 1 <= m) sum += dfs(m, n, nowm + 1, nown); if(nown + 1 <= n) sum += dfs(m, n, nowm, nown + 1); num[nowm][nown] = sum; return sum; } intuniquePaths(int m, int n){ longlong ans = 0; ans = dfs(m, n, 1, 1); return ans; } };