当前位置:网站首页>Sword finger offer 30 Stack containing min function
Sword finger offer 30 Stack containing min function
2022-07-03 19:47:00 【Follow the road to the end】
Defines the data structure of the stack , Please implement a in this type that can get the minimum elements of the stack min The function is in the stack , call min、push And pop The time complexity of O(1).
class MinStack {
constructor () {
// Store stack data
this.data = []
}
// Stack method
push (item) {
this.data.push(item)
}
// Stack method
pop () {
this.data.pop()
}
top () {
return this.data[this.data.length - 1]
}
min () {
return Math.min(...this.data)
}
}1
边栏推荐
- Chapter 1: sum of three factorials, graph point scanning
- Luogu-p1107 [bjwc2008] Lei Tao's kitten
- BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
- Utilisation de base du cadre unitest
- CMD implements the language conversion of locale non Unicode programs
- 原生表格-滚动-合并功能
- The 15 year old interviewer will teach you four unique skills that you must pass the interview
- 第一章: 舍罕王失算
- Xctf attack and defense world crypto master advanced area olddriver
- Flume learning notes
猜你喜欢

2022.2.14 Li Kou - daily question - single element in an ordered array

2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP

If the warehouse management communication is not in place, what problems will occur?

第一章:求同吗小数和s(d, n)

JMeter connection database

Detailed and not wordy. Share the win10 tutorial of computer reinstallation system

第一章:三位阶乘和数,图形点扫描

Sentinel source code analysis part II - sentinel dashboard console startup and configuration

I study database at station B (4): DQL

Bright purple crystal meso tetra (4-aminophenyl) porphyrin tapp/tapppt/tappco/tappcd/tappzn/tapppd/tappcu/tappni/tappfe/tappmn metal complex - supplied by Qiyue
随机推荐
2022-06-27 网工进阶(十二)IS-IS-开销类型、开销计算、LSP的处理机制、路由撤销、路由渗透
2022-06-27 advanced network engineering (XII) IS-IS overhead type, overhead calculation, LSP processing mechanism, route revocation, route penetration
Day11 - my page, user information acquisition, modification and channel interface
Professional interpretation | how to become an SQL developer
The 15 year old interviewer will teach you four unique skills that you must pass the interview
Use unique_ PTR forward declaration? [repetition] - forward declaration with unique_ ptr? [duplicate]
7. Data broker presentation
Leetcode daily question solution: 540 A single element in an ordered array
论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
UE source code analysis: uccharactermovementcomponent - rootmotion
The simplicity of laravel
Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
Geek Daily: the system of monitoring employees' turnover intention has been deeply convinced off the shelves; The meta universe app of wechat and QQ was actively removed from the shelves; IntelliJ pla
Flume learning notes
2022-06-30 advanced network engineering (XIV) routing strategy - matching tools [ACL, IP prefix list], policy tools [filter policy]
BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply
Sentinel source code analysis part II - sentinel dashboard console startup and configuration
The space of C disk is insufficient, and the computer becomes stuck. Quickly expand the capacity of C disk to make the system more smooth
第一章:喝汽水,阶梯电费计算,阶梯电费计算函数,个人所税,求解平方根不等式,简化求解平方根不等式,求解调和级数不等式,解不等式:d<1+1/2-1/3+1/4+1/5-1/6+..士1/n
Comments on flowable source code (37) asynchronous job processor