We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37bc3e2 commit 657ca27Copy full SHA for 657ca27
data_structures/stacks/min_stack.py
@@ -28,6 +28,7 @@
28
- O(n) extra space for the min_stack
29
"""
30
31
+
32
class MinStack:
33
def __init__(self):
34
@@ -86,5 +87,5 @@ def getMin(self) -> int:
86
87
min_stack.push(-3)
88
print("Current Min:", min_stack.getMin()) # Output: -3
89
min_stack.pop()
- print("Top Element:", min_stack.top()) # Output: 0
90
+ print("Top Element:", min_stack.top()) # Output: 0
91
print("Current Min:", min_stack.getMin()) # Output: -2
0 commit comments