Find the maximum element in an array which is first increasing and then decreasing | function to find the maximum element ; Driver code
function findMaximum ( arr , low , high ) { var max = arr [ low ] ; var i ; for ( i = low + 1 ; i <= high ; i ++ ) { if ( arr [ i ] > max ) max = arr [ i ] ; else break ; } return max ; } var arr = [ 1 , 30 , 40 , 50 , 60 , 70 , 23 , 20 ] ; var n = arr . length ; document . write ( " " + findMaximum ( arr , 0 , n - 1 ) ) ;