Driver Code
public static void Main ( String [ ] args ) { int [ ] a = { 4 , 5 , 3 , 7 , 8 , 10 , 9 , 8 } ; int n = a . Length ; int k = 4 ; int [ , ] dp = new int [ n , MAX ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < MAX ; j ++ ) { dp [ i , j ] = - 1 ; } } Console . WriteLine ( recur ( 0 , 0 , 0 , a , n , k , dp ) ) ; } }