Driver code
public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 6 } ; int n = arr . Length ; int M = 4 ; int [ , ] dp = new int [ n + 1 , MAX ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) for ( int j = 0 ; j < MAX ; j ++ ) dp [ i , j ] = - 1 ; Boolean res ; res = isPossible ( n , 0 , 0 , M , arr , dp ) ; Console . WriteLine ( ( res ? " True " : " False " ) ) ; } }