Update stack_II.py

This commit is contained in:
marina 2023-08-07 17:52:44 -07:00 committed by GitHub
parent 975b4d7dbd
commit a079cef3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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