题解 | #包含min函数的栈#
包含min函数的栈
https://www.nowcoder.com/practice/4c776177d2c04c2494f2555c9fcc1e49
# -*- coding:utf-8 -*- class Solution: def __init__(self) -> None: self.stack = [] def push(self, node): # write code here self.stack.append(node) return 1 def pop(self): # write code here return self.stack.pop() def top(self): # write code here return self.stack[-1] def min(self): # write code here return min(self.stack)
剑指offer刷题笔记 文章被收录于专栏
24秋招剑指offer刷题的笔记