Number of shortest paths to reach every cell from bottom | C # program to find number of shortest paths ; Function to find number of shortest paths ; Compute the grid starting from the bottom - left corner ; Print the grid ; Driver code ; Function call
using System ; class GFG { static void NumberOfShortestPaths ( int n , int m ) { int [ , ] a = new int [ n , m ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < m ; j ++ ) { if ( j == 0 i == n - 1 ) a [ i , j ] = 1 ; else a [ i , j ] = a [ i , j - 1 ] + a [ i + 1 , j ] ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { Console . Write ( a [ i , j ] + " ▁ " ) ; } Console . Write ( " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int n = 5 , m = 2 ; NumberOfShortestPaths ( n , m ) ; } }