当前位置:网站首页>Sword finger offer (twenty): stack containing min function
Sword finger offer (twenty): stack containing min function
2022-07-26 10:46:00 【Konstanch】
solution 1: about python Speaking of , Stack is used list Realized !
class Solution:
def __init__(self):
self.stack = []
self.assist = []
def push(self,node):
min = self.min()
if not min or node < min:
self.assist.append(node)
else:
self.assist.append(min)
self.stack.append(node)
def pop(self):
if self.stack:
self.assist.pop()
return self.stack.pop()
def top(self):
if self.stack:
return self.stack[-1]
def min(self):
if self.assist:
return self.assist[-1]
边栏推荐
猜你喜欢

在神州IV开发板上为STemWin 5.22加入触屏驱动

2021-08-12 function recursion_ Learn C language with brother Peng
![[leetcode daily question 2021/8/30]528. Choose randomly by weight [medium]](/img/13/c6cb176d7065035f60d55ad20ed1bf.png)
[leetcode daily question 2021/8/30]528. Choose randomly by weight [medium]

RT thread learning notes (VI) -- start the elmfat file system based on SPI flash (Part 1)

RT-Thread 学习笔记(七)---开启基于SPI Flash的elmfat文件系统(中)

WIRESHARK基础教程以太帧的分析。

$router和$route的区别

344.反转字符串

mysql20210906

Sql Server 数据库之数据类型
随机推荐
剑指Offer(二十):包含min函数的栈
WIRESHARK基础教程以太帧的分析。
display-inline+calc实现左中右布局,中间自适应
剑指Offer(二十):包含min函数的栈
2021-08-14 Sanzi chess
11 handle "self assignment" in operator=
剑指Offer(二十一):栈的压入、弹出序列
mysql20210906
[paper after dinner] deep mining external perfect data for chestx ray disease screening
剑指Offer(七):斐波那契数列
Flutter集成极光推送
[machine learning notes] [face recognition] deeplearning ai course4 4th week programming
104.二叉树的最大深度
Koin
MySQL quick learning notes-2021-08-31
Oracle create index
Flutter jni混淆 引入.so文件release包闪退
C语言命名空间的定义与使用
$router和$route的区别
使用Selenium抓取zabbix性能监控图