当前位置:网站首页>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
边栏推荐
- JMeter connection database
- 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
- 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
- 第一章:拓广同码小数和s(d, n)
- 第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
- BUUCTF
- 6. Data agent object Defineproperty method
- 第一章:递归求n的阶乘n!
- How to improve data security by renting servers in Hong Kong
- Nerfplusplus parameter format sorting
猜你喜欢

Point cloud data denoising

第一章:简化同码小数和s(d, n)

Flume learning notes

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

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

CMD implements the language conversion of locale non Unicode programs

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

Basic principle of LSM tree

Chapter 1: find the factorial n of n!

Chapter 1: sum of three factorials, graph point scanning
随机推荐
Chapter 2: find the classical solution of the maximum Convention and the least common multiple of a and B, find the conventional solution of the maximum Convention and the least common multiple of a a
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
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Professional interpretation | how to become an SQL developer
PR FAQ: how to set PR vertical screen sequence?
Chapter 1: find the factorial n of n!
Use of aggregate functions
Nerfplusplus parameter format sorting
Xctf attack and defense world crypto advanced area best_ rsa
2022-06-28 网工进阶(十三)IS-IS-路由过滤、路由汇总、认证、影响ISIS邻居关系建立的因素、其他命令和特性
Merge K ascending linked lists
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
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
Common text labels
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
原生表格-滚动-合并功能
Cross compile opencv with contrib
NFT without IPFs and completely on the chain?
Web Security (VII) specific process of authentication with session cookie scheme
Octopus online ecological chain tour Atocha protocol received near grant worth $50000