
62. Unique paths
There is a leetcode problem about counting unique paths on mxn grid for a robot that can move either down or right.
Try to guess why this program solves this problem:
(a, b) = (m - 1, n - 1)
let (n, k) = (a + b, min(a,b));
let mut c = 1;
for q in 0..k {
c = c * (n - q) / (q + 1);
}
c
Feel free to leave comments with your explanations.