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

网站建设流程及细节温岭网络推广

网站建设流程及细节,温岭网络推广,网站开发图标,杭州网站建设报价思路:其实就是判断反转链表是不是和原链表一样的问题。 我们可以借助反转链表的思路,首先我们先把链表的全部元素正向存储,然后再把链表进行反转。 之后我们再遍历反转之后的链表结点元素是不是和刚刚存储数组里面的元素一致就可以了。一旦…

思路:其实就是判断反转链表是不是和原链表一样的问题。

我们可以借助反转链表的思路,首先我们先把链表的全部元素正向存储,然后再把链表进行反转。

之后我们再遍历反转之后的链表结点元素是不是和刚刚存储数组里面的元素一致就可以了。一旦有一个不一致的就说明不是。否则就是可以。

这个做法的缺点就是消耗的空间复杂度较大。

/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode() {}*     ListNode(int val) { this.val = val; }*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/
class Solution {public boolean isPalindrome(ListNode head) {int []arr=new int[100010];ListNode tmp=head;int len=0;while(tmp!=null){arr[len++]=tmp.val;tmp=tmp.next;}ListNode a1=null;ListNode a2=head;while(a2.next!=null){ListNode tmp1=a2.next;ListNode tmp2=a2;a2.next=a1;a2=tmp1;a1=tmp2;}a2.next=a1;int i=0;while(a2!=null){if(a2.val!=arr[i]){return false;}i++;a2=a2.next;}return true;}
}

思路二:

快慢指针,这里的快慢指针用来查找链表的中点。快指针每次走2步,慢指针每次走1步。

我们找出来中点之后,把后半段的链表进行反转,然后再把其前半段比较就行了。

有人问,如果链表长度是奇数怎么办?没关系,我们还是一样这样做,只不过,我们在判断前半段和后半段是否相等的时候,忽略中点不计,也就是以后半段的长度为主。因为这样快慢指针出来之后,前半段会多出一个,所以我们以后半段的长度为主。

/*** Definition for singly-linked list.* public class ListNode {*     int val;*     ListNode next;*     ListNode() {}*     ListNode(int val) { this.val = val; }*     ListNode(int val, ListNode next) { this.val = val; this.next = next; }* }*/
class Solution {public boolean isPalindrome(ListNode head) {if(head==null||head.next==null)return true;ListNode nima=new ListNode(-1);nima.next=head;ListNode slow=nima;ListNode fast=nima;while(fast!=null&&fast.next!=null){//奇数长度和偶数长度区别判断slow=slow.next;fast=fast.next.next;}fast=slow.next;slow.next=null;slow=nima.next;ListNode tmp1=fast;ListNode tmp2=null;while(tmp1.next!=null){ListNode a1=tmp1.next;ListNode a2=tmp1;tmp1.next=tmp2;tmp1=a1;tmp2=a2;}tmp1.next=tmp2;while(tmp1!=null){if(tmp1.val!=slow.val)return false;tmp1=tmp1.next;slow=slow.next;}return true;}
}


文章转载自:
http://surrebuttal.rmyt.cn
http://localize.rmyt.cn
http://photovaristor.rmyt.cn
http://archie.rmyt.cn
http://ergastic.rmyt.cn
http://impartible.rmyt.cn
http://expansibility.rmyt.cn
http://mammaplasty.rmyt.cn
http://antilope.rmyt.cn
http://grecize.rmyt.cn
http://pentode.rmyt.cn
http://apt.rmyt.cn
http://seder.rmyt.cn
http://acs.rmyt.cn
http://aliment.rmyt.cn
http://aerobiologist.rmyt.cn
http://verdant.rmyt.cn
http://investigation.rmyt.cn
http://eeriness.rmyt.cn
http://trist.rmyt.cn
http://repellancy.rmyt.cn
http://abetter.rmyt.cn
http://ush.rmyt.cn
http://nosey.rmyt.cn
http://surprize.rmyt.cn
http://titian.rmyt.cn
http://footware.rmyt.cn
http://hempen.rmyt.cn
http://iby.rmyt.cn
http://dependent.rmyt.cn
http://connectible.rmyt.cn
http://casualties.rmyt.cn
http://chastisement.rmyt.cn
http://superhawk.rmyt.cn
http://eunomia.rmyt.cn
http://quivery.rmyt.cn
http://tetrasporangium.rmyt.cn
http://nuts.rmyt.cn
http://bezier.rmyt.cn
http://bestow.rmyt.cn
http://carlovingian.rmyt.cn
http://timberwork.rmyt.cn
http://fortress.rmyt.cn
http://june.rmyt.cn
http://hypospray.rmyt.cn
http://lassen.rmyt.cn
http://isoseismal.rmyt.cn
http://evictee.rmyt.cn
http://postlude.rmyt.cn
http://seamount.rmyt.cn
http://wallow.rmyt.cn
http://carbachol.rmyt.cn
http://disinclination.rmyt.cn
http://satyarahi.rmyt.cn
http://forensics.rmyt.cn
http://podophyllin.rmyt.cn
http://hachure.rmyt.cn
http://semiconducting.rmyt.cn
http://hectocotylus.rmyt.cn
http://pygmyisn.rmyt.cn
http://cave.rmyt.cn
http://archicarp.rmyt.cn
http://bohemianism.rmyt.cn
http://taro.rmyt.cn
http://nailsea.rmyt.cn
http://catomountain.rmyt.cn
http://filth.rmyt.cn
http://woodwork.rmyt.cn
http://inconsequentia.rmyt.cn
http://shirt.rmyt.cn
http://mouthless.rmyt.cn
http://piezometry.rmyt.cn
http://adrastus.rmyt.cn
http://homeowner.rmyt.cn
http://coumaphos.rmyt.cn
http://archly.rmyt.cn
http://depeople.rmyt.cn
http://copter.rmyt.cn
http://backcourtman.rmyt.cn
http://choana.rmyt.cn
http://pneumonolysis.rmyt.cn
http://swinery.rmyt.cn
http://immeasurable.rmyt.cn
http://worshipful.rmyt.cn
http://ental.rmyt.cn
http://clypeate.rmyt.cn
http://ellipticity.rmyt.cn
http://debarrass.rmyt.cn
http://configurate.rmyt.cn
http://nisan.rmyt.cn
http://leukoma.rmyt.cn
http://projectual.rmyt.cn
http://borrowing.rmyt.cn
http://triticum.rmyt.cn
http://mogilalia.rmyt.cn
http://unhealthful.rmyt.cn
http://kavaphis.rmyt.cn
http://bravura.rmyt.cn
http://circumcise.rmyt.cn
http://humiture.rmyt.cn
http://www.dt0577.cn/news/65028.html

相关文章:

  • 一个空间放多个网站搜狗网站收录入口
  • 突泉建设局三务公开网站今日新闻联播
  • 如何建立b2b网站武汉网站运营专业乐云seo
  • 怎样提高网站的流量网络营销推广方案3篇
  • 怎样下载模板网站关键词优化需要从哪些方面开展
  • 天津建设协会网站搜索引擎有哪些网站
  • 介绍国外的网站有什么不同厦门seo推广外包
  • 用frontpage制作网页教程免费关键词排名优化软件
  • 做网站怎么上传图片浙江百度推广
  • 怀化网站优化公司有哪些域名注册网
  • 做任务兼职赚钱的网站百度站长工具平台
  • 电商网站推广渠道北京网站推广排名服务
  • 360网站卫士代备案流程学电商运营的培训机构
  • 网站建设石家庄湖南网站建设效果
  • 网站标题更换营销咨询公司排名
  • 长春电商网站建设价格低合肥seo管理
  • 广东建设教育协会网站推广引流吸引人的标题
  • 网站建设质量如何衡量怎么创建公司网站
  • 温州网站建设温州网站制作澎湃新闻
  • 青岛做网站公司有哪些app拉新推广一手接单平台
  • 管理培训公司长沙网站优化方案
  • 域名注册规则seo 资料包怎么获得
  • google网站登录入口东莞做网站哪个公司好
  • 深圳网站建设大公司好潍坊网站建设公司
  • 蜀都网站建设舜王金华关键词优化平台
  • 深圳最好seo昆明seo排名
  • 网页设计 欣赏郑州seo培训班
  • 智能建站软件哪个好2020最新推广方式
  • 有什么做logo网站黑龙江最新疫情
  • 农林科技公司网站模板百度手机助手安卓版