082 O(n) solution using stack to keep track the bars increasing order.