当前位置:网站首页>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
边栏推荐
- BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu
- Common text labels
- 4. Data binding
- Part 28 supplement (XXVIII) busyindicator (waiting for elements)
- Native table - scroll - merge function
- Point cloud data denoising
- BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
- Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record
- 第一章:求同吗小数和s(d, n)
- Xctf attack and defense world crypto advanced area best_ rsa
猜你喜欢

2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】

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

Chapter 1: find the factorial n of n!
![Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles](/img/70/6fd00146418e5d481e951d51428990.png)
Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles

Network security Kali penetration learning how to get started with web penetration how to scan based on nmap

04 -- QT OpenGL two sets of shaders draw two triangles

Acquisition and transmission of parameters in automatic testing of JMeter interface

kubernetes集群搭建efk日志收集平台

BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply

2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
随机推荐
Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
Win10 share you don't have permission
Nerfplusplus parameter format sorting
Comments on flowable source code (37) asynchronous job processor
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
unittest框架基本使用
第一章:求n的阶乘n!
Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
Nacos usage of micro services
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
Blue Bridge Cup: the fourth preliminary - "simulated intelligent irrigation system"
2022-06-28 advanced network engineering (XIII) IS-IS route filtering, route summary, authentication, factors affecting the establishment of Isis neighbor relations, other commands and characteristics
Chapter 1: extend the same code decimal sum s (D, n)
Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
Titles can only be retrieved in PHP via curl - header only retrieval in PHP via curl
Xctf attack and defense world crypto master advanced area olddriver
Chapter 1: recursively find the factorial n of n!
Zhang Fei hardware 90 day learning notes - personal record on day 6. Please see my personal profile / homepage for the complete record
Sentinel source code analysis part II - sentinel dashboard console startup and configuration