mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-07-22 14:30:49 -04:00
Update stack_II.py
This commit is contained in:
parent
975b4d7dbd
commit
a079cef3d2
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ class Stack:
|
||||||
|
|
||||||
def push(self, val: int) -> None:
|
def push(self, val: int) -> None:
|
||||||
self.stack.append((val, self.min))
|
self.stack.append((val, self.min))
|
||||||
if self.min != None:
|
if self.min is not None:
|
||||||
self.min = min(self.min, val)
|
self.min = min(self.min, val)
|
||||||
else:
|
else:
|
||||||
self.min = val
|
self.min = val
|
||||||
|
@ -30,7 +30,7 @@ class Stack:
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getMin(self) -> int:
|
def get_min(self) -> int:
|
||||||
if self.stack:
|
if self.stack:
|
||||||
return self.min
|
return self.min
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue