Find the last remaining element after repeated removal of an element from pairs of increasing adjacent array elements | Function to print the last remaining array element after after performing given operations ; If size of the array is 1 ; Check for the condition ; If condition is not satisfied ; Driver Code ; Function Call
def canArrayBeReduced ( arr , N ) : NEW_LINE INDENT if ( N == 1 ) : NEW_LINE INDENT print ( arr [ 0 ] ) NEW_LINE return NEW_LINE DEDENT if ( arr [ 0 ] < arr [ N - 1 ] ) : NEW_LINE INDENT print ( arr [ N - 1 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Not ▁ Possible " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arr = [ 6 , 5 , 2 , 4 , 1 , 3 , 7 ] NEW_LINE N = len ( arr ) NEW_LINE canArrayBeReduced ( arr , N ) NEW_LINE DEDENT