Check if array can be converted into strictly decreasing sequence | Function to check that array can be converted into a strictly decreasing sequence ; Loop to check that each element is greater than the ( N - index ) ; If element is less than ( N - index ) ; If array can be converted ; Driver Code ; Function calling
def check ( arr , n ) : NEW_LINE INDENT flag = True ; NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( arr [ i ] < n - i ) : NEW_LINE INDENT flag = False ; NEW_LINE DEDENT DEDENT if ( flag ) : NEW_LINE INDENT return True ; NEW_LINE DEDENT else : NEW_LINE INDENT return False ; NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT arr1 = [ 11 , 11 , 11 , 11 ] ; NEW_LINE n1 = len ( arr1 ) ; NEW_LINE if ( check ( arr1 , n1 ) ) : NEW_LINE INDENT print ( " Yes " ) ; NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) ; NEW_LINE DEDENT DEDENT