Condition to check if the top of the stack is greater than the current element
if ( S [ i ] < s [ s . length - 1 ] ) { s . push ( S [ i ] ) ; nix = Math . min ( nix , S [ i ] ) ; } else { let val = S [ i ] ;