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

网站内地图位置怎么做非自己的网站如何做二次跳转

网站内地图位置怎么做,非自己的网站如何做二次跳转,交换友链平台,做网站 智域大连24. 两两交换链表中的节点 - 力扣#xff08;LeetCode#xff09; 定义三个指针#xff0c;交换前先保存ntnt指针为next-next#xff0c;cur和next两个节点#xff0c;然后将pre-next指向next 若pre为空#xff0c;说明当前交换的节点为头两个节点#xff0c;…24. 两两交换链表中的节点 - 力扣LeetCode 定义三个指针交换前先保存ntnt指针为next-nextcur和next两个节点然后将pre-next指向next 若pre为空说明当前交换的节点为头两个节点不需要修改pre-next 若cur不为空而next为空则将pre-next指向cur 然后根据ntnt更新三个节点当cur或者next为nullptr时终止交换 /*** Definition for singly-linked list.* struct ListNode {* int val;* ListNode *next;* ListNode() : val(0), next(nullptr) {}* ListNode(int x) : val(x), next(nullptr) {}* ListNode(int x, ListNode *next) : val(x), next(next) {}* };*/ class Solution { public:ListNode* swapPairs(ListNode* head) {ListNode *pre nullptr;ListNode *cur head, *next nullptr;if (cur) next cur-next;if (next) head next;while (next cur){ListNode *ntnt next-next;next-next cur; cur-next nullptr;if (pre) pre-next next;pre cur, cur ntnt;if (cur) next cur-next;}if (pre cur (next nullptr)) pre-next cur;return head;} };25. K 个一组翻转链表 - 力扣LeetCode 先统计俩表中节点的数量n需要翻转(n / k)组链表 使用哨兵new_head作为伪头节点 记录上一次k组的尾节点初始为new_head 翻转完一组节点将尾节点的next指向刚才翻转一组节点的头节点 对于每组节点的翻转使用三个指针将pre-cur修改cur-pre再用next更新两个指针pre curcur next 每个子链表需要翻转k - 1次一共需要翻转n / k组 最后若k不能整除n那么将上一组节点的尾节点next指向剩下节点的头节点 若k能整除n那么将上一组节点的尾节点next指向nullptr /*** Definition for singly-linked list.* struct ListNode {* int val;* ListNode *next;* ListNode() : val(0), next(nullptr) {}* ListNode(int x) : val(x), next(nullptr) {}* ListNode(int x, ListNode *next) : val(x), next(next) {}* };*/ class Solution { public:ListNode* reverseKGroup(ListNode* head, int k) {int n 0;ListNode *cur head;while (cur){cur cur-next;n ;}ListNode *new_head new ListNode;ListNode *pre head;ListNode *hhead nullptr, *tail new_head;if (pre) cur pre-next;for (int i 0; i n / k; i){ ListNode *new_tail pre;for (int j 0; j k - 1; j){ListNode *next cur-next;cur-next pre;pre cur, cur next;}hhead pre, tail-next hhead, tail new_tail;if (cur) pre cur, cur cur-next;}if (n % k) tail-next pre;else tail-next nullptr;return new_head-next;} };
http://www.dnsts.com.cn/news/279313.html

相关文章:

  • 辽宁天一建设有限责任公司网站dede 学校网站
  • 东莞住房建设网站的网自己做网站的成本
  • dede打包好的网站怎么提取模板qq群引流推广平台免费
  • dz网站收款即时到账怎么做的市场采购贸易平台
  • 手机网站免费模板鲜花店的网站建设
  • 微信怎么做链接网站临沂专业网站制作公司
  • 网站策划怎么做内容佛山网站建设设计
  • 公司网站不续费能打开网页吗网线制作工具
  • 网站动画效果用什么程序做的手机网站 jsp
  • 淘宝的网站建设软件平台包括什么
  • 网站底部样式wordpress软件著作权
  • 南阳市网站制作山东网站建站系统平台
  • 老客户网站建设企业邮箱多少钱一年
  • 深圳网站建设服务找哪家100个免费设计网站
  • 合肥论坛建站模板东莞市疾控中心官网
  • 网站页面设计师设计师网站接单
  • 网站设计的要素西安网站建设哪家专业
  • 外贸企业的网站建设建筑公司企业章程
  • 软件网站开发合同html5 国内网站建设
  • 做头像的网站横杆带字wordpress什么样
  • 网站图片太多怎么办做第一个php网站
  • 7天精通网站建设实录简介242商业网站推荐
  • 学校网站建设调查报告学校网站的图片轮播怎么做
  • 坪地网站建设基本流程去wordpress化
  • 什么是优化型网站做网站是怎样赚钱的
  • 商城网站风格上海公司购买新能源车条件
  • 网站首页调用网站标题软件项目管理项目计划书
  • 深圳网站建设找智恒网络如何在阿里云部署网站
  • c .net网站开发东莞购物网站
  • 地方门户网站系统建设方案龙游发布紧急提示