Driver code
int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 6 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int M = 4 ; int dp [ n + 1 ] [ MAX ] ; memset ( dp , -1 , sizeof ( dp ) ) ; bool res ; res = isPossible ( n , 0 , 0 , M , arr , dp ) ; cout << ( res ? " True " : " False " ) << endl ; return 0 ; }