If the element at top of stack is less than the current element then pop the stack top and keep updating the value of h3
while ( st . length != 0 && st [ st . length - 1 ] < arr [ i ] ) { h3 = st [ st . length - 1 ] ; st . pop ( ) ; }