time limit exceeded


  • 0
    L


    int uniquePaths(int m, int n) {
    if (m == 1 && n == 1) return 1;
    else if (m == 1 && n > 1) return uniquePaths(m, n-1);
    else if (m > 1 && n == 1) return uniquePaths(m-1, n);
    else if (m > 1 && n > 1) return uniquePaths(m, n-1) + uniquePaths(m-1, n);
    }


Log in to reply
 

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