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

网站被降权韩国还有出线的可能

网站被降权,韩国还有出线的可能,福建有没有网站做鞋子一件代发,专业画册设计力扣爆刷第107天之CodeTop100五连刷21-25 文章目录 力扣爆刷第107天之CodeTop100五连刷21-25一、103. 二叉树的锯齿形层序遍历二、92. 反转链表 II三、54. 螺旋矩阵四、160. 相交链表五、23. 合并 K 个升序链表 一、103. 二叉树的锯齿形层序遍历 题目链接#xff1a;https://…力扣爆刷第107天之CodeTop100五连刷21-25 文章目录 力扣爆刷第107天之CodeTop100五连刷21-25一、103. 二叉树的锯齿形层序遍历二、92. 反转链表 II三、54. 螺旋矩阵四、160. 相交链表五、23. 合并 K 个升序链表 一、103. 二叉树的锯齿形层序遍历 题目链接https://leetcode.cn/problems/binary-tree-zigzag-level-order-traversal/description/ 思路本题要求每层先从左往右遍历下一层从右往左再往下一层又变成了从左往右遍历就是这种交替遍历其实层序遍历的方式我们不需要改变只需要改变记录的方式对于每层出队节点收集时如果该层是要求正序那么把元素从尾部添加进新队列如果该层要求逆序那就从头部添加进队列因为尾插法是正序头插法是逆序遍历后然后再把收集到的数据添加进总集合中即可。 class Solution {ListListInteger arrayList new ArrayList();LinkedListTreeNode queue new LinkedList();public ListListInteger zigzagLevelOrder(TreeNode root) {if(root null) return arrayList;boolean flag true;queue.add(root);while(!queue.isEmpty()) {int size queue.size();LinkedListInteger list new LinkedList();for(int i 0; i size; i) {TreeNode node queue.poll();if(flag) {list.addLast(node.val);}else{list.addFirst(node.val);}if(node.left ! null) {queue.add(node.left);}if(node.right ! null) {queue.add(node.right);}}flag !flag;arrayList.add(new ArrayList(list));}return arrayList;} } 二、92. 反转链表 II 题目链接https://leetcode.cn/problems/reverse-linked-list-ii/description/ 思路翻转链表中的一个片段没啥技术含量定位到为止然后头插法然后拼接尾部。 class Solution {public ListNode reverseBetween(ListNode head, int left, int right) {ListNode root new ListNode(-1, head);ListNode p root, pro root, pre null, end null;for(int i 0; i left; i) {pro p;p p.next;}pro.next null;end p;for(int i left; i right; i) {pre p.next;p.next pro.next;pro.next p;p pre;}end.next p;return root.next;} }三、54. 螺旋矩阵 题目链接https://leetcode.cn/problems/spiral-matrix/description/ 思路螺旋矩阵控制上下左右边界例如只要上边界小于等于下边界就可以读取一行如果左边界小于等于右边就可以读取一列。 class Solution {ListInteger spiralOrder(int[][] matrix) {ListInteger list new ArrayList();int m matrix.length, n matrix[0].length;int left 0, right n-1, up 0, down m-1;while(list.size() m * n) {if(up down) {for(int i left; i right; i) {list.add(matrix[up][i]);}up;}if(left right) {for(int i up; i down; i) {list.add(matrix[i][right]);}right--;}if(up down) {for(int i right; i left; i--) {list.add(matrix[down][i]);}down--;}if(left right) {for(int i down; i up; i--) {list.add(matrix[i][left]);}left;}} return list;} }四、160. 相交链表 题目链接https://leetcode.cn/problems/intersection-of-two-linked-lists/description/ 思路经典题目两个链表都先求长度然后遍历统一长度然后同步遍历即可。 public class Solution {public ListNode getIntersectionNode(ListNode headA, ListNode headB) {ListNode pa headA, pb headB;int lenA 0, lenB 0;while(pa ! null) {pa pa.next;lenA;}while(pb ! null) {pb pb.next;lenB;}pa headA;pb headB;while(lenA lenB) {pb pb.next;lenB--;}while(lenA lenB) {pa pa.next;lenA--;}while(pa ! null) {if(pa pb) return pa;pa pa.next;pb pb.next;}return null;} }五、23. 合并 K 个升序链表 题目链接https://leetcode.cn/problems/merge-k-sorted-lists/description/ 思路采用优先级队列链表按照头部节点进行优先级排序出队后然后再入队然后一直出队统计即可。 class Solution { public ListNode mergeKLists(ListNode[] lists) {PriorityQueueListNode queue new PriorityQueue((a, b) - a.val-b.val);for(ListNode node : lists) {if(node ! null) {queue.add(node);}}ListNode root new ListNode();ListNode p root;while(!queue.isEmpty()) {ListNode node queue.poll();p.next node;p p.next;if(node.next ! null) {queue.add(node.next);}}return root.next;} }
http://www.pierceye.com/news/153764/

相关文章:

  • flash网站用什么做网站建设免费软件有哪些
  • 卖车网站投资网站建设
  • 网站开发过程 文档合肥婚恋网站建设
  • 网站自助建设目录更新 wordpress
  • 百度给做网站吗flash网站制作教程 下载
  • 化工销售怎么做网站wordpress 论坛功能
  • 网上做平面设计兼职不错的网站网站 seo优化
  • seo做的最好的网站设计专业
  • 顾家家居网站是哪个公司做的东莞软件有限公司
  • 云南做网站哪家好wordpress文章内多页效果
  • 上海做网站公司哪家好建筑公司有哪些部门和职位
  • 用front page2003做网站的导航条网站的站点建设分为
  • 开封网站建设zducmwordpress评论ajax
  • 电脑如何做网站空间西安网站建设sxyun
  • 济南历城区网站建设2022年没封网站直接进入
  • 平面设计和网站建设哪个好icp备案可以自己搞吗
  • 平面电商网站建设初级网页设计
  • 个人购物网站怎么备案数据调查的权威网站
  • 网站规划和建设的基本要求100个无水印短视频素材免费
  • 河北住房和建设厅官方网站如何建设运输网站
  • 网络品牌网站建设价格网站设计部
  • 用自己照片做衣服 杯子的是哪个网站深圳东门老街
  • 四川省乐山市建设银行网站互联网保险行业发展报告
  • 厦门手机网站建设是什么山东泰安昨晚发生的事
  • 山西网站开发公司园林景观设计公司计划书
  • 吉林平安建设网站项城市建设规划局网站
  • 购物网站er图经营管理培训课程
  • 男女明星直接做的视频网站wordpress设置的页面跳转失败
  • 建企业网站价格wordpress稳定吗
  • 免费1级做爰网站研发项目管理系统