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

郑州网站优化顾问网络营销与直播电商是什么

郑州网站优化顾问,网络营销与直播电商是什么,详情页设计逻辑,网站首页源码本系列为笔者的 Leetcode 刷题记录#xff0c;顺序为 Hot 100 题官方顺序#xff0c;根据标签命名#xff0c;记录笔者总结的做题思路#xff0c;附部分代码解释和疑问解答#xff0c;01~07为C语言#xff0c;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;}MapCharacter, Character pairs new HashMap() {{put(), ();put(], [);put(}, {);}};DequeCharacter stack new LinkedList();for(int i0; 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 {DequeInteger xStack;DequeInteger 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) {LinkedListString 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;LinkedListString 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(LinkedListString 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]; //存储下标差值LinkedListInteger stack new LinkedList(); //存储下标 温度比较for(int i0; ilength; 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;DequeInteger stack new ArrayDeque(); //高度一路上升存储柱子下标//2.for循环、遍历柱子下标for(int i0; in; 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://www.hkea.cn/news/14451903/

相关文章:

  • 网站网络拓扑图wordpress评论框美化
  • 长春做网站价格wordpress注意
  • 建立网站需要多少钱费用公司网站建设安全的风险
  • 陕西省建设资格注册中心网站wordpress提问插件
  • 建站系统下载 discuzhtml网页设计题库
  • 做网站软件的公司客户又找不到你
  • 网站源码智慧团建网站登录密码是啥
  • 做卖东西的网站多少钱做网站销售电销好做吗
  • 视觉做的比较好的国外网站壹淘购返利网
  • 东莞企业建站程序网站倒计时怎么做
  • 网站快速排名优化高级网络技术工程师
  • 网站开发拓扑图ppt模板免费下载 素材中国风
  • 天河区建设水务局网站wordpress动漫整站
  • 顺德网站优化公司做兼职的网站有哪些工作内容
  • 用自己的名字做网站域名免费家装设计效果图
  • 手机 pc网站开发价格兰州seo
  • 建设银行论坛网站企业网站的设计与实现
  • 免费做网站怎么做网站ppt制作模板免费下载
  • 德阳网站建设优化网站推广方案整理
  • 淘宝的好券网站怎么做马鞍山网站建设推广
  • 网站建设管理自查报告淘宝优惠网站怎么做
  • 新乡做网站哪家好怎么看网站是什么语言做的后台
  • 民宿设计网站大全厦门网站建站
  • 深圳做网站哪家好wordpress自带重定向
  • 工程建设科学技术奖申报网站电商网课
  • wordpress文章商品导购网站seo关键词排名查询
  • 贸易公司网站建设随意设计一个网站
  • 制作网站基本步骤用淘宝做公司网站
  • 实现网站计划书rails开发的网站开发
  • 深圳做企业网站个人网站模板html免费