Space and time complexity?

how both the complexities are O(1) , I am not able to understand?

hello @namangarg31
here the time and space complexity is for extracting min from stack only.

here to get minimum we just have to check for stack top thats is why O(1) time complexxity.

and to get minimum we are not using any extra space thats why O(1) space complexity

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.