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

湖北正规网站建设检修网站ui设计包括哪些原则

湖北正规网站建设检修,网站ui设计包括哪些原则,爱站网关键词挖掘,做旅行社网站题目链接 反转链表:206. 反转链表 - 力扣(LeetCode)K个一组翻转链表:25. K 个一组翻转链表 - 力扣(LeetCode)回文链表:234. 回文链表 - 力扣(LeetCode) 实现思路 代码实…

题目链接

  • 反转链表:206. 反转链表 - 力扣(LeetCode)
  • K个一组翻转链表:25. K 个一组翻转链表 - 力扣(LeetCode)
  • 回文链表:234. 回文链表 - 力扣(LeetCode)

实现思路

代码实现

  • 反转链表:
/*** 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* reverseList(ListNode* head) {ListNode* pre = nullptr;ListNode* cur = head;while(cur) {ListNode* next = cur -> next;cur -> next = pre;pre = cur;cur = next;}return pre;}
};
  • K个一组翻转链表
/*** 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:vector<ListNode*> reverse(ListNode* head, ListNode* next) {ListNode* pre = next;ListNode* cur = head;while (cur != next) {ListNode* nextNode = cur -> next;cur -> next = pre;pre = cur;cur = nextNode;}return {pre, head}; // pre是反转之后的头节点,head是反转之后的尾节点}ListNode* reverseKGroup(ListNode* head, int k) {int cnt = 0;ListNode* cur = head;ListNode* preHead = new ListNode(-1);preHead -> next = head;ListNode* pre = preHead;while (cur) {cnt++;if (cnt % k == 0) {cnt = 0;vector<ListNode*> res = reverse(pre->next, cur->next);pre->next = res[0];cur = res[1];pre = cur;}cur = cur -> next;}return preHead -> next;}
};
  • 回文链表
/*** 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* reverse(ListNode* head) {ListNode* pre = nullptr;ListNode* cur = head;while (cur) {ListNode* next = cur -> next;cur -> next = pre;pre = cur;cur = next;}return pre;}bool isPalindrome(ListNode* head) {if (head -> next == nullptr) return true;ListNode* preHead = new ListNode();preHead -> next = head;ListNode* slow = preHead;ListNode* fast = preHead;while (fast != nullptr && fast -> next != nullptr) {slow = slow -> next;fast = fast -> next -> next;}// 反转slow->next到tail的部分ListNode* head1 = slow -> next;head1 = reverse(head1);ListNode* cur = head;ListNode* cur1 = head1;while (cur1) {if (cur -> val != cur1 -> val) {return false;}cur = cur -> next;cur1 = cur1 -> next;}return true;}
};


文章转载自:

http://j63StQAI.spnky.cn
http://aATHqX6b.spnky.cn
http://6xzroow3.spnky.cn
http://54EDLntL.spnky.cn
http://qD603dLv.spnky.cn
http://Yc4M8cHT.spnky.cn
http://mFEao8Kc.spnky.cn
http://cpIRQ0JO.spnky.cn
http://QDZEHi1Z.spnky.cn
http://l2vxG2qw.spnky.cn
http://A2fkS7r3.spnky.cn
http://7Xo3Me1X.spnky.cn
http://vtot0FFo.spnky.cn
http://N3EzQwhf.spnky.cn
http://gkCnz2u2.spnky.cn
http://NrELvXH9.spnky.cn
http://CA0SzwmU.spnky.cn
http://ntcGVnNJ.spnky.cn
http://I5SfnLpa.spnky.cn
http://JMFH8uaY.spnky.cn
http://LoII3e2b.spnky.cn
http://Ich6623Y.spnky.cn
http://i4YLswFo.spnky.cn
http://XNn2YOLS.spnky.cn
http://60CqPI4V.spnky.cn
http://GijIPMuT.spnky.cn
http://i2A3xG4P.spnky.cn
http://G82NW74t.spnky.cn
http://AOu67u2A.spnky.cn
http://nm2LNoCk.spnky.cn
http://www.dtcms.com/wzjs/625332.html

相关文章:

  • 石家庄外贸网站建设公司郎溪网站建设
  • 德州做网站dzqifanwordpress 购买
  • 旅游网站建设问题创建wordpress插件
  • 建设公司网站内容做细分领域的同城网站
  • 网站设计实训报告用凡科做网站有自己的域名
  • 昆明网站建站推广中诺建设集团有限公司网站
  • 个人求职网站设计app成本
  • html网站支付链接怎么做的海口小程序制作公司
  • 贵州网站制作品牌公司ppt做长图网站
  • 学做网站去哪学内容营销的定义
  • 用什么语言来做网站wordpress好还是织梦好
  • 网站登录记录怎么删除如何将网站生成二维码
  • 做的网站怎么打开是白板免费h5场景制作软件
  • 做棋牌网站建设哪家好好的搜索引擎推荐
  • 网页制作教程网站一般的电脑培训班要多少钱
  • 国外的域名注册网站电脑html如何转wordpress
  • 网站建设的上市公司深圳网站排名怎么做
  • 网站建设中 提示黄骅市旅游景点有哪些
  • 网站优化新闻开发游戏用什么编程软件
  • 深圳做高端网站建设公司济南网站推广
  • 做网站 多少钱手机宣传网站
  • 郑州做网站推广的公司网站建设用图片
  • 淄博企业高端网站建设电商代运营公司排行榜
  • 网站上的支付接口怎么做注册网站的免费网址
  • 网站如何做营销网络服务优势
  • 旅行社网站建设规划电脑手机一体网站
  • 旅游网站栏目建设网站排名标准
  • 食品网站的网页设计宁波专业网站制作设计
  • 佛山自助建站系统响应式网站开发技术
  • 企业网站要更新文章吗wordpress justnews