-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
Bug Report for https://neetcode.io/problems/minimum-stack
When I run my code using the sample input, the output matches expectations. However, when I submit the exact same code, the results differ.
Langauge: Python
Input: ["MinStack", "push", -1, "push", 3, "push", -4, "getMin", "pop", "getMin", "top"]
class MinStack:
stack = []
minStack = []
def push(self, val: int) -> None:
self.stack.append(val)
if len(self.minStack) > 0:
self.minStack.append(min(self.minStack[-1], val))
else:
self.minStack.append(val)
def pop(self) -> None:
self.stack.pop()
self.minStack.pop()
def top(self) -> int:
return self.stack[-1]
def getMin(self) -> int:
return self.minStack[-1]
Metadata
Metadata
Assignees
Labels
No labels