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 ++ ) Arrays . fill ( dp [ i ] , - 1 ) ; boolean res ; res = isPossible ( n , 0 , 0 , M , arr , dp ) ; System . out . println ( ( res ? " True " : " False " ) ) ; } }