Here in pop why are we popping element from all 3 stacks ? I think we need to check if the topmost element in the mainstack is the element that is on top of minimum stack and on top of maximum stack then we need to pop from max or min stack.Am I right?

Here in pop why are we popping element from all 3 stacks ? I think we need to check if the topmost element in the mainstack is the element that is on top of minimum stack and on top of maximum stack then we need to pop from max or min stack.Am I right?

No, do a dry run @riagoel3999

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.