Driver program to test above function
public static void main ( String [ ] args ) { int grid [ ] [ ] = { { 1 , 2 , 3 , 4 , 5 } , { 6 , 7 , 8 , 9 , 10 } } ; int n = 5 ; System . out . println ( maxSum ( grid , n ) ) ; } }