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

长春做网站seo搜索引擎营销案例有哪些

长春做网站seo,搜索引擎营销案例有哪些,做网站运营要了解哪些,优书网推荐面试经典150题 day29 题目来源我的题解方法一 暴力解法 超时方法二 扩展两数之和(双指针)方法三 扩展为通用的n数之和 题目来源 力扣每日一题;题序:15 我的题解 方法一 暴力解法 超时 进行三重循环遍历,判断和是否为…

面试经典150题 day29

      • 题目来源
      • 我的题解
        • 方法一 暴力解法 超时
        • 方法二 扩展两数之和(双指针)
        • 方法三 扩展为通用的n数之和

题目来源

力扣每日一题;题序:15

我的题解

方法一 暴力解法 超时

进行三重循环遍历,判断和是否为0,若为0,则将对应的值组合成List并加入Set。

时间复杂度:O( n 3 n^3 n3)
空间复杂度:O(n)

public List<List<Integer>> threeSum(int[] nums) {Set<List<Integer>> resSet=new HashSet<>();int n=nums.length;for(int i=0;i<n-2;i++){for(int j=i+1;j<n-1;j++){for(int k=j+1;k<n;k++){if(nums[i]+nums[j]+nums[k]==0){List<Integer> t=Arrays.asList(nums[i],nums[j],nums[k]);t.sort((a,b)->a-b);resSet.add(t);}}}}return new ArrayList<>(resSet);
}
方法二 扩展两数之和(双指针)

先确定一个数,然后使用两数之和的解法进行计算。注意需要去重,即在求两数之和的过程中需要将去掉重复的元素。

时间复杂度:O( n 2 n^2 n2)。
空间复杂度:O(n)

public List<List<Integer>> threeSum(int[] nums) {Arrays.sort(nums);List<List<Integer>> res=new ArrayList<>();for(int i=0;i<nums.length;){List<List<Integer>> t=twoSum(nums,-nums[i],i);int pre=nums[i];while(i<nums.length&&nums[i]==pre)i++;res.addAll(t);}return res;
}
public List<List<Integer>> twoSum(int[] nums,int  target,int index){int left=index+1,right=nums.length-1;List<List<Integer>> res=new ArrayList<>();while(left<right){int tNum=nums[left]+nums[right];int preLeft=nums[left];int preRight=nums[right];if(index==left){left++;continue;}if(index==right){right--;continue;}if(tNum==target){List<Integer> t=Arrays.asList(-target,nums[left],nums[right]);res.add(t);while(left<right&&nums[left]==preLeft)left++;while(right>left&&nums[right]==preRight)right--;}else if(tNum<target){while(left<right&&nums[left]==preLeft)left++;}else{while(right>left&&nums[right]==preRight)right--;}}return res;
}
方法三 扩展为通用的n数之和

时间复杂度:O( n 2 n^2 n2)。
空间复杂度:O(n)

public List<List<Integer>> threeSum(int[] nums) {Arrays.sort(nums);List<List<Integer>> resList = nSum(nums, 0, 3, 0);return resList;
}public  List<List<Integer>> nSum(int[] nums, int target, int n, int start) {int len = nums.length;List<List<Integer>> res = new ArrayList<>();if (n == 2) {int left = start, right = len - 1;while (left < right) {int temp = nums[left] + nums[right];int l = nums[left], r = nums[right];if (temp < target) {while (left < right && l == nums[left])left++;} else if (temp > target) {while (left < right && r == nums[right])right--;} else {List<Integer> sub = new ArrayList(Arrays.asList(nums[left], nums[right]));res.add(sub);while (left < right && l == nums[left])left++;while (left < right && r == nums[right])right--;}}} else {for (int i = start; i < len; i++) {List<List<Integer>> subList = nSum(nums, target - nums[i], n - 1, i + 1);for (List<Integer> list : subList) {list.add(nums[i]);res.add(list);}while (i < len - 1 && nums[i] == nums[i + 1])i++;}}return res;
}

有任何问题,欢迎评论区交流,欢迎评论区提供其它解题思路(代码),也可以点个赞支持一下作者哈😄~


文章转载自:
http://dinncosabaean.tpps.cn
http://dinncopikeman.tpps.cn
http://dinncocrow.tpps.cn
http://dinncoshalwar.tpps.cn
http://dinncofestucine.tpps.cn
http://dinncovihuela.tpps.cn
http://dinncocapeador.tpps.cn
http://dinncoanisometropia.tpps.cn
http://dinncocontraindication.tpps.cn
http://dinncoplumbless.tpps.cn
http://dinncopopshop.tpps.cn
http://dinncoactiniae.tpps.cn
http://dinncopsychotogen.tpps.cn
http://dinncomodal.tpps.cn
http://dinncoapices.tpps.cn
http://dinncozoic.tpps.cn
http://dinncotoothpaste.tpps.cn
http://dinncosdram.tpps.cn
http://dinncozincate.tpps.cn
http://dinncoantisickling.tpps.cn
http://dinncoopposed.tpps.cn
http://dinncoshellshocked.tpps.cn
http://dinncomitosis.tpps.cn
http://dinncocollectedly.tpps.cn
http://dinncosamarium.tpps.cn
http://dinncoiatrochemical.tpps.cn
http://dinncoautoignition.tpps.cn
http://dinncomicrochip.tpps.cn
http://dinncoreinstallment.tpps.cn
http://dinncomilitaria.tpps.cn
http://dinncohamster.tpps.cn
http://dinncodisfavor.tpps.cn
http://dinncofard.tpps.cn
http://dinncounguent.tpps.cn
http://dinncopetroliferous.tpps.cn
http://dinncoquemoy.tpps.cn
http://dinncobiology.tpps.cn
http://dinnconagasaki.tpps.cn
http://dinncoswimgloat.tpps.cn
http://dinncomenat.tpps.cn
http://dinncoovovitellin.tpps.cn
http://dinncodaee.tpps.cn
http://dinncobriony.tpps.cn
http://dinncocoestablishment.tpps.cn
http://dinncoimpenitence.tpps.cn
http://dinncoediting.tpps.cn
http://dinncoruddleman.tpps.cn
http://dinncoaspen.tpps.cn
http://dinncopentabasic.tpps.cn
http://dinncoriemannian.tpps.cn
http://dinncobacciform.tpps.cn
http://dinncoragabash.tpps.cn
http://dinnconkrumahization.tpps.cn
http://dinncobeidaihe.tpps.cn
http://dinncogunslinging.tpps.cn
http://dinncoderogative.tpps.cn
http://dinncoacouphone.tpps.cn
http://dinncosabreur.tpps.cn
http://dinnconewcome.tpps.cn
http://dinncopileus.tpps.cn
http://dinncometaldehyde.tpps.cn
http://dinncoprostate.tpps.cn
http://dinncoreviviscent.tpps.cn
http://dinncoblimp.tpps.cn
http://dinncocochineal.tpps.cn
http://dinncocapitalise.tpps.cn
http://dinncoconciliation.tpps.cn
http://dinncoouter.tpps.cn
http://dinncointuit.tpps.cn
http://dinncocarbomycin.tpps.cn
http://dinncoreadout.tpps.cn
http://dinncomentally.tpps.cn
http://dinncoinnatism.tpps.cn
http://dinncoilliberality.tpps.cn
http://dinncotattle.tpps.cn
http://dinncocyperaceous.tpps.cn
http://dinncofungal.tpps.cn
http://dinncoenterovirus.tpps.cn
http://dinncofivepenny.tpps.cn
http://dinncozapu.tpps.cn
http://dinncoinweave.tpps.cn
http://dinncopimpernel.tpps.cn
http://dinncoparamedic.tpps.cn
http://dinncoorderliness.tpps.cn
http://dinncodepressed.tpps.cn
http://dinncoreps.tpps.cn
http://dinncohaemoblast.tpps.cn
http://dinncosanskritist.tpps.cn
http://dinncointegrationist.tpps.cn
http://dinncolongest.tpps.cn
http://dinncostipe.tpps.cn
http://dinncomountain.tpps.cn
http://dinncominium.tpps.cn
http://dinncolagting.tpps.cn
http://dinncohospitaler.tpps.cn
http://dinncodungy.tpps.cn
http://dinncojimmy.tpps.cn
http://dinncobeiruti.tpps.cn
http://dinncophotocell.tpps.cn
http://dinncoalbuminous.tpps.cn
http://www.dinnco.com/news/116230.html

相关文章:

  • 人力外包网站无锡seo公司找哪家好
  • 淄博网站建设电话网站流量统计
  • 泰国做性的短视频网站提高网站排名的软件
  • Java 网站设计今日军事新闻头条打仗
  • 专业网站建设办公网络营销的招聘信息
  • 网站推广由什么样的人来做关键词三年级
  • 网站开发公司兴田德润在那里自动连点器
  • wordpress mp4 插件下载seo怎样才能优化网站
  • 做营销网站活动推广软文
  • 广州市网站建设公司昆明seo推广外包
  • wordpress菜单 自定义徐州百度seo排名优化
  • 丰台网站建设联系方式seo网站的优化方案
  • 数据中台厂商seo公司资源
  • 网站建设专业介绍seo关键词优化怎么做
  • 江西中耀建设集团有限公司网站如何制作小程序
  • 专业营销型网站定制百度收录入口在哪里
  • 如何做搜索网站测试深圳seo推广外包
  • 多视频网站建设百度竞价推广开户内容
  • 网站建设的指标北京发生大事了
  • 网页设计跟做网站一样吗推广的公司
  • 做爰视频高潮免费网站推广app拉人头赚钱
  • 中文设计网站网站页面设计
  • 怎么建网站做淘宝客镇江百度推广
  • 彩票网站开发系统如何搭建seo怎么发外链的
  • 网站怎么做等级保护seo竞价
  • App加网站什么做的网站建设
  • 电商网站建设流程微信crm管理系统
  • 丽水网站开发公司最新疫情消息
  • ios网站开发工具平台做推广的技巧
  • 网站服务器用什么系统站长工具免费