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
function canArrayBeReduced ( arr , N ) { if ( N == 1 ) { document . write ( arr [ 0 ] ) ; return ; } if ( arr [ 0 ] < arr [ N - 1 ] ) { document . write ( arr [ N - 1 ] ) ; } else document . write ( " " ) ; } let arr = [ 6 , 5 , 2 , 4 , 1 , 3 , 7 ] ; let N = arr . length ; canArrayBeReduced ( arr , N ) ;