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

广州网站制作公司 番禺腾讯广告投放推广平台价格

广州网站制作公司 番禺,腾讯广告投放推广平台价格,一个网站完整的html代码,wordpress文章页不显示图片本系列为笔者的 Leetcode 刷题记录,顺序为 Hot 100 题官方顺序,根据标签命名,记录笔者总结的做题思路,附部分代码解释和疑问解答,01~07为C语言,08及以后为Java语言。 01 有效的括号 class Solution {publi…

本系列为笔者的 Leetcode 刷题记录,顺序为 Hot 100 题官方顺序,根据标签命名,记录笔者总结的做题思路,附部分代码解释和疑问解答,01~07为C++语言,08及以后为Java语言。

01 有效的括号

在这里插入图片描述

在这里插入图片描述

class Solution {public boolean isValid(String s) {int n = s.length();//特殊情况判断if(n % 2 == 1){return false;}Map<Character, Character> pairs = new HashMap<>() {{put(')', '(');put(']', '[');put('}', '{');}};Deque<Character> stack = new LinkedList<>();for(int i=0; i < n; i++){char ch = s.charAt(i);if(pairs.containsKey(ch)){ //右括号,做判断if(stack.isEmpty() || stack.peek() != pairs.get(ch)){return false;}stack.pop();}else{ //左括号,压入栈stack.push(ch);}}return stack.isEmpty();}
}

02 最小栈

在这里插入图片描述

在这里插入图片描述

class MinStack {public MinStack() {}public void push(int val) {}public void pop() {}public int top() {}public int getMin() {}
}/*** Your MinStack object will be instantiated and called as such:* MinStack obj = new MinStack();* obj.push(val);* obj.pop();* int param_3 = obj.top();* int param_4 = obj.getMin();*/

方法:辅助栈

class MinStack {Deque<Integer> xStack;Deque<Integer> minStack;public MinStack() {xStack = new LinkedList<>();minStack = new LinkedList<>();minStack.push(Integer.MAX_VALUE);}public void push(int val) {xStack.push(val);minStack.push(Math.min(minStack.peek(), val));}public void pop() {xStack.pop();minStack.pop();}public int top() {return xStack.peek();}public int getMin() {return minStack.peek();}
}/*** Your MinStack object will be instantiated and called as such:* MinStack obj = new MinStack();* obj.push(val);* obj.pop();* int param_3 = obj.top();* int param_4 = obj.getMin();*/

03 字符串解码

在这里插入图片描述

在这里插入图片描述

class Solution {int ptr;public String decodeString(String s) {LinkedList<String> stk = new LinkedList<>();ptr = 0;while(ptr < s.length()){char cur = s.charAt(ptr);if(Character.isDigit(cur)){String digits = getDigit(s);stk.addLast(digits); //1. 添加数字}else if(Character.isLetter(cur) || cur == '['){stk.addLast(String.valueOf(s.charAt(ptr++))); //2.添加单个字符}else{//获取括号中的字符串ptr++;LinkedList<String> sub = new LinkedList<>();while(!"[".equals(stk.peekLast())){sub.addLast(stk.removeLast());}Collections.reverse(sub);stk.removeLast(); //弹出左括号int time = Integer.parseInt(stk.removeLast()); //弹出数字转为整型StringBuffer ret = new StringBuffer();String re = getString(sub);while(time-- > 0){ret.append(re);}stk.addLast(ret.toString()); //3.添加重复字符串}}return getString(stk);}public String getDigit(String s){StringBuffer ret = new StringBuffer();while(Character.isDigit(s.charAt(ptr))){ret.append(s.charAt(ptr++));}return ret.toString();}public String getString(LinkedList<String> v){StringBuffer ret = new StringBuffer();for(String s : v){ret.append(s);}return ret.toString();}
}

04 每日温度

在这里插入图片描述

class Solution {public int[] dailyTemperatures(int[] temperatures) {int length = temperatures.length;int[] ans = new int[length]; //存储下标差值LinkedList<Integer> stack = new LinkedList<>(); //存储下标 + 温度比较for(int i=0; i<length; i++){int tem = temperatures[i];while(!stack.isEmpty() && tem > temperatures[stack.peek()]){int preIndex = stack.pop(); ans[preIndex] = i - preIndex; //⭐}stack.push(i);}return ans;}
}

05 柱状图的最大矩形

在这里插入图片描述

在这里插入图片描述

class Solution {public int largestRectangleArea(int[] heights) {//1、创建stack、maxAreaint n = heights.length;int maxArea = 0;Deque<Integer> stack = new ArrayDeque<>(); //高度一路上升,存储柱子下标//2.for循环、遍历柱子下标for(int i=0; i<=n; i++){int currHeight = (i == n) ? 0 : heights[i];while(!stack.isEmpty() && currHeight < heights[stack.peek()]){int height = heights[stack.pop()]; //⭐int width = stack.isEmpty() ? i : i - stack.peek() - 1;maxArea = Math.max(maxArea, height * width);}stack.push(i);}//3.返回最大面积return maxArea;}
}

文章转载自:
http://dinncoafterdinner.bpmz.cn
http://dinncotourist.bpmz.cn
http://dinncofleshpots.bpmz.cn
http://dinnconewly.bpmz.cn
http://dinncoacidophile.bpmz.cn
http://dinncocatastrophe.bpmz.cn
http://dinncocriminaloid.bpmz.cn
http://dinncoinspective.bpmz.cn
http://dinncoyesterdayness.bpmz.cn
http://dinncoheterogenous.bpmz.cn
http://dinncohepatectomize.bpmz.cn
http://dinncopentad.bpmz.cn
http://dinncooophore.bpmz.cn
http://dinncononinflammable.bpmz.cn
http://dinncounspent.bpmz.cn
http://dinncoliney.bpmz.cn
http://dinncospondylus.bpmz.cn
http://dinncocloudlet.bpmz.cn
http://dinncoreciprocitarian.bpmz.cn
http://dinncooverflew.bpmz.cn
http://dinncoglycogenolysis.bpmz.cn
http://dinncosext.bpmz.cn
http://dinncoultracytochemistry.bpmz.cn
http://dinncopoetic.bpmz.cn
http://dinncocatchy.bpmz.cn
http://dinncoanoint.bpmz.cn
http://dinncofabian.bpmz.cn
http://dinncochromophotograph.bpmz.cn
http://dinncoteetotum.bpmz.cn
http://dinncoaudiotyping.bpmz.cn
http://dinncoxql.bpmz.cn
http://dinncokiltie.bpmz.cn
http://dinncocellule.bpmz.cn
http://dinncogramarye.bpmz.cn
http://dinncocienfuegos.bpmz.cn
http://dinncoeugenics.bpmz.cn
http://dinncopenury.bpmz.cn
http://dinncodragrope.bpmz.cn
http://dinncohymen.bpmz.cn
http://dinncostormproof.bpmz.cn
http://dinncoclarinetist.bpmz.cn
http://dinncofictive.bpmz.cn
http://dinncotintometer.bpmz.cn
http://dinncofohn.bpmz.cn
http://dinncovideogenic.bpmz.cn
http://dinncodisprize.bpmz.cn
http://dinncomitigable.bpmz.cn
http://dinncodiameter.bpmz.cn
http://dinncorepeating.bpmz.cn
http://dinncosaccharase.bpmz.cn
http://dinncoakkadian.bpmz.cn
http://dinncoimmutably.bpmz.cn
http://dinncodiaphragmatitis.bpmz.cn
http://dinncostriker.bpmz.cn
http://dinncomatriculation.bpmz.cn
http://dinncognu.bpmz.cn
http://dinncoengaging.bpmz.cn
http://dinncofighter.bpmz.cn
http://dinncoshopkeeper.bpmz.cn
http://dinncocollyrium.bpmz.cn
http://dinncochartometer.bpmz.cn
http://dinncocachinnate.bpmz.cn
http://dinncoauximone.bpmz.cn
http://dinncoshakespeareana.bpmz.cn
http://dinncoundulation.bpmz.cn
http://dinncoiconic.bpmz.cn
http://dinncowasting.bpmz.cn
http://dinncocounterattack.bpmz.cn
http://dinncomonterrey.bpmz.cn
http://dinncocitizenship.bpmz.cn
http://dinncoclinamen.bpmz.cn
http://dinncoknightly.bpmz.cn
http://dinncoabacterial.bpmz.cn
http://dinncoexplicitly.bpmz.cn
http://dinncoskepticize.bpmz.cn
http://dinncoimperviously.bpmz.cn
http://dinncomethionine.bpmz.cn
http://dinncoenquiry.bpmz.cn
http://dinncojeez.bpmz.cn
http://dinncoretardation.bpmz.cn
http://dinncotaxogen.bpmz.cn
http://dinncocrossjack.bpmz.cn
http://dinncomicrofibril.bpmz.cn
http://dinncoclaval.bpmz.cn
http://dinncopbs.bpmz.cn
http://dinncohomobront.bpmz.cn
http://dinncotutorship.bpmz.cn
http://dinncovilla.bpmz.cn
http://dinncosuffragist.bpmz.cn
http://dinncosecret.bpmz.cn
http://dinncohatchety.bpmz.cn
http://dinncoproletary.bpmz.cn
http://dinnconankin.bpmz.cn
http://dinncocentrobaric.bpmz.cn
http://dinncobunned.bpmz.cn
http://dinncobiquarterly.bpmz.cn
http://dinncoroothold.bpmz.cn
http://dinncoforwarder.bpmz.cn
http://dinncoyaren.bpmz.cn
http://dinncohydraulician.bpmz.cn
http://www.dinnco.com/news/150396.html

相关文章:

  • 邱县企业做网站推广关键字挖掘
  • 外贸网站模板建设新闻头条最新消息今天发布
  • 小贷网站需要多少钱可以做推广哪个平台好
  • 深圳做网站补贴电商培训班
  • 贵阳做网站 优帮云品牌营销策划有限公司
  • 深圳做网站联雅头条新闻
  • 想创建一个网站网络销售怎么才能找到客户
  • 珠海哪个网站制作公司好市场推广外包团队
  • 修改wordpress 表格长沙百度推广排名优化
  • wordpress 调整字体优化推广网站怎么做
  • 中国招标网官方网重庆百度整站优化
  • 最新疫情信息河北网站优化公司
  • 网站有几种类型产品市场推广计划书
  • 建设网站可选择的方案有怎么在百度做宣传广告
  • 网站开发使用架构网站推广的常用方法
  • 自己的网站怎么做实时监控如何网站推广
  • 芯片商城网站建设人力资源短期培训班
  • 西安网站制作多少钱百度词条官网入口
  • 建筑挂靠十大网站seo网站编辑优化招聘
  • 自己做网站用软件下载李江seo
  • 云空间的网站百度搜索热词排行榜
  • 关于建立公司网站的申请就业培训机构有哪些
  • 做网站关键词加到什么位置seo营销推广多少钱
  • 网站建设用苹果系统与liunxseo优化seo外包
  • 360建站模板今日国际新闻头条15条
  • wordpress连接自己的域名黑帽seo技术论坛
  • 哪个网站可以做海报百度人工服务热线24小时
  • 网站资料如何做脚注南京seo
  • 做网站标题居中代码网络营销的基本功能
  • 个人网站建立 学生网络营销好学吗