MAX is the Maximum value M can take
dp = [ [ - 1 ] * ( n + 1 ) ] * MAX NEW_LINE res = isPossible ( n , 1 , arr [ 0 ] , M , arr , dp ) NEW_LINE if ( res == True ) : NEW_LINE INDENT print ( " True " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " False " ) NEW_LINE DEDENT