# LeetCode 173. Binary Search Tree Iterator

Binary Search Tree Iterator

# LeetCode 155. Min Stack

Min Stack. Basically, the trick is to use another stack to keep track of all the push-in min number, so that whenever a current min number is popped, the next…

# LeetCode 150. Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation. This is a typical stack problem. Whenever there is a number, push it to the stack, whenever there is a operator, push two number from the…

# LeetCode 20. Valid Parentheses

Valid Parentheses. Classic stack problem. When you encounter a left parentheses, push it to a stack. When you encounter a right parentheses, pop the stack. If the pop left parentheses…

# LeetCode 85. Maximal Rectangle

Maximal Rectangle. This problem is an extended version of Largest Rectangle in Histogram. We just need to calculate the heights in each row and find the largest rectangle in those heights.

# LeetCode 84. Largest Rectangle in Histogram

Largest Rectangle in Histogram. I tried to solve this problem by using an O(n2) solution (Loop through all heights, count the number of heights continually larger than the current height…