Simple C# Solution


  • 0
    T
    public int UniquePaths(int m, int n) 
    {
       int[] array = new int[n];
       
       for( int k = 0; k < n; ++k )
          array[k] = 1;
    
       for( int i = m - 2; i >=0; --i )
           for( int j = n-2; j >=0; --j )
               array[j] += array[j+1];
    
       return array[0];
     }

Log in to reply
 

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