Condition to check if the top of the stack is greater than the current element
if ( S . get ( i ) < s . peek ( ) ) { s . add ( S . get ( i ) ) ; nix = Math . min ( nix , S . get ( i ) ) ; } else { int val = S . get ( i ) ;