Monotonic Stack Implementation Leetcode