Preview:
    int uniquePaths(int m, int n) {
        int N = m + n - 2, r = min(m, n)-1;
        long long p = 1;
        for(int i = 1 ; i <= r; i++){
            p = (p *(N - i + 1))/i;
        }
        return p;
    }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter