Grid Unique Paths
https://www.interviewbit.com/problems/grid-unique-paths/
int Solution::uniquePaths(int N, int M) {
long long ans = 1;
for (int i = M; i < (N + M - 1); i++) {
ans *= i;
ans /= (i - M + 1);
}
return ans;
}
Comments
Post a Comment