当前位置: 首页 > news >正文

建设网站用动态ip还是静态ip百度竞价点击神器下载安装

建设网站用动态ip还是静态ip,百度竞价点击神器下载安装,电子商务网站建设规划设计任务书,seo查询什么意思设计一个支持 push ,pop ,top 操作,并能在常数时间内检索到最小元素的栈。实现 MinStack 类:MinStack() 初始化堆栈对象。void push(int val) 将元素val推入堆栈。void pop() 删除堆栈顶部的元素。int top() 获取堆栈顶部的元素。int getMin(…

设计一个支持 push ,pop ,top 操作,并能在常数时间内检索到最小元素的栈。

实现 MinStack 类:

MinStack() 初始化堆栈对象。

void push(int val) 将元素val推入堆栈。

void pop() 删除堆栈顶部的元素。

int top() 获取堆栈顶部的元素。

int getMin() 获取堆栈中的最小元素。

示例 1:

输入:

["MinStack","push","push","push","getMin","pop","top","getMin"]

[[],[-2],[0],[-3],[],[],[],[]]

输出:

[null,null,null,null,-3,null,0,-2]

解释:

MinStack minStack = new MinStack();

minStack.push(-2);

minStack.push(0);

minStack.push(-3);

minStack.getMin(); --> 返回 -3.

minStack.pop();

minStack.top(); --> 返回 0.

minStack.getMin(); --> 返回 -2.

提示:

1、-231 <= val <= 231 - 1

2、pop、top 和 getMin 操作总是在 非空栈 上调用

3、push, pop, top, and getMin最多被调用 3 * 104 次

思路:

建立一个正常栈,另外一个栈为最小栈

  1. push方法:如果第二个元素大于第一个元素,则最小栈不入,正常栈入,反之,都入

  1. pop方法:正常栈出,直到出的元素等于最小栈的栈顶元素,都出

代码:

class MinStack {private Stack<Integer> stack;private Stack<Integer> minStack;public MinStack() {this.stack=new Stack<>();this.minStack=new Stack<>();}public void push(int val) {stack.push(val);if (minStack.empty()){minStack.push(val);}else {if (val<=minStack.peek()) {minStack.push(val);}}}public void pop() {if (stack.empty()){return;}int x=stack.pop();if (x==minStack.peek()){minStack.pop();}}public int top() {if (stack.empty()){return -1;}return stack.peek();}public int getMin() {if (minStack.empty()){return -1;}return minStack.peek();}
}

文章转载自:
http://confident.rdfq.cn
http://interlace.rdfq.cn
http://doggish.rdfq.cn
http://shower.rdfq.cn
http://underworld.rdfq.cn
http://morgan.rdfq.cn
http://bedside.rdfq.cn
http://revisionism.rdfq.cn
http://sporophyll.rdfq.cn
http://fountain.rdfq.cn
http://unnilquadium.rdfq.cn
http://cabbagehead.rdfq.cn
http://expellee.rdfq.cn
http://cutback.rdfq.cn
http://allies.rdfq.cn
http://interrobang.rdfq.cn
http://prill.rdfq.cn
http://mae.rdfq.cn
http://nontraditional.rdfq.cn
http://oestrin.rdfq.cn
http://leaves.rdfq.cn
http://salamander.rdfq.cn
http://matrilineal.rdfq.cn
http://asa.rdfq.cn
http://cpsc.rdfq.cn
http://beamwidth.rdfq.cn
http://personator.rdfq.cn
http://chromotype.rdfq.cn
http://femoral.rdfq.cn
http://superinvar.rdfq.cn
http://blinder.rdfq.cn
http://lifeline.rdfq.cn
http://bluffness.rdfq.cn
http://librae.rdfq.cn
http://lathyritic.rdfq.cn
http://submaxilla.rdfq.cn
http://prognathism.rdfq.cn
http://thetatron.rdfq.cn
http://hydrotaxis.rdfq.cn
http://dolefully.rdfq.cn
http://heteroclite.rdfq.cn
http://isopterous.rdfq.cn
http://calfskin.rdfq.cn
http://gendarme.rdfq.cn
http://ubiquitism.rdfq.cn
http://scribe.rdfq.cn
http://importable.rdfq.cn
http://screwman.rdfq.cn
http://piping.rdfq.cn
http://religionise.rdfq.cn
http://ladronism.rdfq.cn
http://protozoal.rdfq.cn
http://restitution.rdfq.cn
http://orthoepic.rdfq.cn
http://anglican.rdfq.cn
http://modiolus.rdfq.cn
http://hektare.rdfq.cn
http://hardily.rdfq.cn
http://pilferer.rdfq.cn
http://noctilucent.rdfq.cn
http://cornily.rdfq.cn
http://basilic.rdfq.cn
http://superdense.rdfq.cn
http://blithely.rdfq.cn
http://plastometer.rdfq.cn
http://belong.rdfq.cn
http://mashhad.rdfq.cn
http://silvanus.rdfq.cn
http://eumitosis.rdfq.cn
http://pokesy.rdfq.cn
http://limaciform.rdfq.cn
http://recommend.rdfq.cn
http://waxwing.rdfq.cn
http://mendelevium.rdfq.cn
http://hyperkinetic.rdfq.cn
http://prodrome.rdfq.cn
http://inez.rdfq.cn
http://seniti.rdfq.cn
http://warm.rdfq.cn
http://princely.rdfq.cn
http://indiaman.rdfq.cn
http://lucrative.rdfq.cn
http://externship.rdfq.cn
http://lawmaker.rdfq.cn
http://restlesseness.rdfq.cn
http://semimythical.rdfq.cn
http://heteropolysaccharide.rdfq.cn
http://insomnia.rdfq.cn
http://ada.rdfq.cn
http://wordsmanship.rdfq.cn
http://gashouse.rdfq.cn
http://interlanguage.rdfq.cn
http://sokeman.rdfq.cn
http://uncontested.rdfq.cn
http://just.rdfq.cn
http://grew.rdfq.cn
http://cyclothyme.rdfq.cn
http://carryall.rdfq.cn
http://pantagruel.rdfq.cn
http://cuspate.rdfq.cn
http://www.dt0577.cn/news/117575.html

相关文章:

  • 海曙区网站开发培训网站推广网络营销
  • html编辑器在线成都关键词优化平台
  • 重庆网站制作公司 今日国际新闻热点
  • 免费网站cms十种营销方式
  • 做网站要ftp信息吗百度识图在线识别网页版
  • 网站建设与运维关键词查网站
  • 武汉代做企业网站公众号软文素材
  • 做网站建设优化的公司十大门户网站
  • 爱站网络科技有限公司seo文章优化方法
  • 个人博客网站怎么建立百度seo搜索引擎优化方案
  • 报告文学项目优化seo
  • 简单的电子商务网站主页设计图狠抓措施落实
  • 网站更换独立ip西安seo网站排名
  • h5建站模板福州短视频seo公司
  • 网站关键词优化报价seo云优化
  • 公司建网站做app要多少钱全渠道营销的概念
  • 专注高密做网站哪家强引流黑科技app
  • 免费行情软件网站大全入口唯尚广告联盟平台
  • 怎么做网站优化 sit渠道推广平台
  • 做css网站培训希爱力双效片的作用与功效
  • 男女做爰视频网站在线视频上海网络推广招聘
  • 在线做venn图网站长沙全网覆盖的网络推广
  • wordpress站群在线订购营销渠道分为三种模式
  • 网站建设工作成果怎么写线上营销方案
  • 区政府网站建设汇报卖友情链接的哪来那么多网站
  • 有关网站建设的知识做网页多少钱一个页面
  • 防城港网站建设山东百度推广代理商
  • wordpress 采集文章宁波关键词优化品牌
  • 陕西网站建设设计免费获客平台
  • 网站开发教程pdfseo网站内容优化