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

20m带宽做网站够用吗如何用ps做网站页面设计

20m带宽做网站够用吗,如何用ps做网站页面设计,哪有做网站公司,永久免费网站怎么建题目链接 反转链表: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://www.dtcms.com/wzjs/617180.html

相关文章:

  • 晨旭东方网站建设台前网站建设价格
  • 成都 网站建设网站关键词几个字
  • 厦门外贸网站制作网站小图标
  • 企业网站建设价格表网站建设术语名词
  • 中山学校的网站建设网络营销方式和技巧
  • 宁波网站建设培训哪家好潍坊网站建设设计
  • 世界上最有趣的网站动态购物网站
  • 交互型网站网站建设与规划总结怎么写
  • 网站推广神器网站项目建设所需成本
  • wordpress建站难不难权威发布新冠疫苗接种禁忌
  • 梧州网站设计推荐昊诺网站建设网络推广
  • 网站前台修改昆明网络建站公司
  • 网站备案证书下载密码忘了毛网商城
  • 河南网站seo营销多少费用人才网站建设cms
  • 岳阳网站建设 熊掌号河北建网站
  • 秦皇岛城乡住房建设厅网站手机网站 焦点图
  • 深圳建设网站龙岗网站建设具有价值的广州做网站
  • 专业做包装的电商网站昆凌做的广告买化妆品网站
  • 专为中年人做的的婚恋网站做羞羞的事的视频网站
  • app网站建设一般多少钱网站域名查询网址
  • 珠海网站制作渠道宁夏建设学院官方网站
  • 版面设计网站有哪些ip查询网站
  • 网站建设waocc广州微信网站开发
  • 网站如何判断做的好不好网络推广公司司
  • 购买了网站如何使用吗广州网站设计专注乐云seo
  • 做产品封面的网站大学专业建设的内容
  • 建个人网站的详细步骤企业多语言网站开发
  • 外贸推广用中文网站wordpress 移动端m
  • 做实验流程图的网站网站自动采集指标
  • 做公众号主页面的有哪些网站晓风彩票门户网站建设