Difficulty: Medium
Acceptance: 22.59%
Points: 30.00
You are tasked with implementing a stack that supports the following operations while handling up to **q** queries: 1. **Push**: Add an integer x to the top of the stack. 2. **Pop**: Remove and return the top element of the stack. If the stack is empty, return -1. 3. **GetMin**: Retrieve the smallest element in the stack in constant time (O(1)). If the stack is empty, return -1. You will receive a series of queries, and each query will perform one of the following actions: - 1 x: Add the integer x to the top of the stack. - 2: Remove and return the top element of the stack. If the stack is empty, return -1. - 3: Return the smallest element in the stack. If the stack is empty, return -1.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
