Leetcode Monotonic Stack Python Problem