Challenging Solution


  • 0
    C
    public class Solution {
            public int uniquePaths(int m, int n) {
                m--;
                n--;
                double ans = 1;
                for(int i = 1 ; i <= n ; i++){
                    ans = (ans*(m+i))/i;
                }
                return (int) ans;
            }
       }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.