Note that all the operations have to be constant time operations.
Questions to ask the interviewer :
Q: What should getMin() do on empty stack? A: In this case, return -1.NOTE : If you are using your own declared global variables, make sure to clear them out in the constructor.
Q: What should pop do on empty stack? A: In this case, nothing.
Q: What should top() do on empty stack? A: In this case, return -1
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.