Leetcode 150 Evaluate Reverse Polish Notation
We will use stacks to solve this problem. A couple tricky thing to note: Solution
We will use stacks to solve this problem. A couple tricky thing to note: Solution
For Javascript users, we can utilized an array to implement most of the functionalities in O(1) time since both push and pop from array are constant time operations. But for getMin we need to keep another stack called minStack to… Read More »Leetcode 155 Min Stack
The key of solving this problem is to use a stack. But before we do that we need to split the string based on /. This way it will give us the parts between slashes which actually determines if we… Read More »Leetcode 71 Simplify Path
The key of solving this problem is to use a stack. Whenever we see an open parenthesis we push it to the stack, when we see an close parenthesis we check if it matches the latest one in the stack,… Read More »Leetcode 20 Valid Parentheses