leetcode
155. Min Stack
Solution code
constructor
Time complexity: O(1)
Space complexity: O(1)
push
Time complexity: O(1)
Space complexity: O(n)
pop
Time complexity: O(1)
Space complexity: O(n)
top
Time complexity: O(1)
Space complexity: O(n)
getMin
Time complexity: O(1)
Space complexity: O(n)