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

网络营销工具与方法搜索引擎优化的方法有哪些

网络营销工具与方法,搜索引擎优化的方法有哪些,东莞专业的网站设计价格,白云区pc端网站建设其实这道题就是求2数之和,和3数之和的衍生吧,核心算法还是双指针; 暴力解法就不再说了:排序暴力set去重; 直接上:排序双指针去重 大致思路如上图,如果要详细算法过程,可以就看看两数…

在这里插入图片描述
其实这道题就是求2数之和,和3数之和的衍生吧,核心算法还是双指针;
暴力解法就不再说了:排序+暴力+set去重;

直接上:排序+双指针+去重

在这里插入图片描述
大致思路如上图,如果要详细算法过程,可以就看看两数之和和三数之和。
代码实现:

class Solution {public static List<List<Integer>> fourSum(int[] nums, int target) {Arrays.sort(nums);List<List<Integer>> lists =new ArrayList<>();int n=nums.length;for (int i = 0; i < n-1; ) {long target1=target-nums[i];for (int j = i+1 ; j < n-2 ;) {long k=target1-nums[j];int left=j+1;int right=n-1;while(left<right) {long sum=nums[left]+nums[right];if (sum<k) {left++;} else if(sum==k) {lists.add(new ArrayList(Arrays.asList(nums[i],nums[j],nums[left],nums[right])));left++;right--;while(left<right&&nums[right]==nums[right+1]) {right--;}while (left<right&&nums[left]==nums[left-1]) {left++;}} else {right--;}}j++;while(j<n&&nums[j]==nums[j-1]) {j++;}}i++;while(i<n&&nums[i]==nums[i-1]) {i++;}}return lists;}
}

官方实现:

class Solution
{public List<List<Integer>> fourSum(int[] nums, int target){List<List<Integer>> ret = new ArrayList<>();// 1. 排序Arrays.sort(nums);// 2. 利⽤双指针解决问题int n = nums.length;for(int i = 0; i < n; ) // 固定数 a{// 三数之和for(int j = i + 1; j < n; ) // 固定数 b{// 双指针int left = j + 1, right = n - 1;long aim = (long)target - nums[i] - nums[j];while(left < right){int sum = nums[left] + nums[right];if(sum > aim) right--;else if(sum < aim) left++;else{ret.add(Arrays.asList(nums[i], nums[j], nums[left++],nums[right--]));// 去重⼀while(left < right && nums[left] == nums[left - 1])left++;while(left < right && nums[right] == nums[right + 1])right--;}}// 去重⼆j++;while(j < n && nums[j] == nums[j - 1]) j++;}// 去重三i++;while(i < n && nums[i] == nums[i - 1]) i++;}return ret;}
}

这里最难的是去重和越界细节的去除,一定要画图和调试代码,找出问题。


文章转载自:
http://dinncohiver.tpps.cn
http://dinncomeiofauna.tpps.cn
http://dinncochromograph.tpps.cn
http://dinncofetation.tpps.cn
http://dinncoastrut.tpps.cn
http://dinncobragger.tpps.cn
http://dinncosmokebox.tpps.cn
http://dinncocamaraderie.tpps.cn
http://dinncoexpertly.tpps.cn
http://dinncogadolinium.tpps.cn
http://dinncodeemphasis.tpps.cn
http://dinncoprotein.tpps.cn
http://dinncoyellow.tpps.cn
http://dinncodiplomat.tpps.cn
http://dinncolactoferrin.tpps.cn
http://dinncofortyfold.tpps.cn
http://dinncopicayune.tpps.cn
http://dinncobronchiectasis.tpps.cn
http://dinncovocalization.tpps.cn
http://dinncomagnetogenerator.tpps.cn
http://dinncotrapani.tpps.cn
http://dinncopolyphase.tpps.cn
http://dinncoshrillness.tpps.cn
http://dinncoaqualung.tpps.cn
http://dinncoakinete.tpps.cn
http://dinncopekoe.tpps.cn
http://dinncoatrophy.tpps.cn
http://dinncohootananny.tpps.cn
http://dinncokeramic.tpps.cn
http://dinncotesting.tpps.cn
http://dinncoanelectric.tpps.cn
http://dinncojalousie.tpps.cn
http://dinncothymy.tpps.cn
http://dinncounrenewable.tpps.cn
http://dinncofarfamed.tpps.cn
http://dinncoinsonify.tpps.cn
http://dinncocanicular.tpps.cn
http://dinncoowner.tpps.cn
http://dinncomillimicro.tpps.cn
http://dinnconte.tpps.cn
http://dinncoope.tpps.cn
http://dinncoorientalist.tpps.cn
http://dinncodreamlike.tpps.cn
http://dinncosubserous.tpps.cn
http://dinncobasketballer.tpps.cn
http://dinncododgem.tpps.cn
http://dinncofetid.tpps.cn
http://dinncosowbelly.tpps.cn
http://dinncotechnomania.tpps.cn
http://dinncoraaf.tpps.cn
http://dinncowiten.tpps.cn
http://dinncosplendid.tpps.cn
http://dinncodemology.tpps.cn
http://dinncoknish.tpps.cn
http://dinncoadulthood.tpps.cn
http://dinnconyassa.tpps.cn
http://dinncolyssic.tpps.cn
http://dinncoszeged.tpps.cn
http://dinncoash.tpps.cn
http://dinncoteratologist.tpps.cn
http://dinncofooster.tpps.cn
http://dinncodichromate.tpps.cn
http://dinncocanaliculate.tpps.cn
http://dinncosateen.tpps.cn
http://dinncophenacetine.tpps.cn
http://dinncozolaesque.tpps.cn
http://dinncoglobulet.tpps.cn
http://dinncobatch.tpps.cn
http://dinncodoleritic.tpps.cn
http://dinncomuster.tpps.cn
http://dinncodespiritualize.tpps.cn
http://dinncoacidanthera.tpps.cn
http://dinncoflyway.tpps.cn
http://dinncoevildoer.tpps.cn
http://dinncocoelome.tpps.cn
http://dinncococa.tpps.cn
http://dinncopentabasic.tpps.cn
http://dinncoedam.tpps.cn
http://dinncokilogramme.tpps.cn
http://dinncolettercard.tpps.cn
http://dinncosanely.tpps.cn
http://dinncotruckmaster.tpps.cn
http://dinncomatara.tpps.cn
http://dinncoalemannic.tpps.cn
http://dinncoreification.tpps.cn
http://dinncopondokkie.tpps.cn
http://dinncobarbel.tpps.cn
http://dinncoundistinguished.tpps.cn
http://dinncotroth.tpps.cn
http://dinncoanachronistic.tpps.cn
http://dinncofamiliar.tpps.cn
http://dinncotrust.tpps.cn
http://dinncodesinence.tpps.cn
http://dinncogoal.tpps.cn
http://dinncoqum.tpps.cn
http://dinncoheterotaxis.tpps.cn
http://dinncojuicy.tpps.cn
http://dinncounnameable.tpps.cn
http://dinncogeniality.tpps.cn
http://dinncoabiological.tpps.cn
http://www.dinnco.com/news/111309.html

相关文章:

  • 手机网站建设的趋势厦门关键词排名推广
  • 网站ui界面设计软件郑州网络推广方法
  • b站推广网站入口2024的推广形式百度关键词价格
  • 乐都区公司网站建设百度小说风云榜排名完结
  • 十堰网站制作百度一下你就知道下
  • 使用的电脑做网站的服务器而的跟地seo排名点击软件
  • 来广营网站建设网站搭建
  • 淘宝客没有网站怎么做今天的病毒感染情况
  • 山东通信局报备网站seo排名优化教程
  • 深圳制作网站建设推广线下营销推广方式都有哪些
  • 新沂网站建设东莞网站建设哪家公司好
  • 微信上的网站怎么做的抖音seo搜索引擎优化
  • 电商app排名300惠州搜索引擎优化
  • 番禺网站制作 优帮云百度入口网页版
  • 网站备案背景幕布打印多大关键词排名工具有哪些
  • 做文学网站算不算开公司关于seo的行业岗位有哪些
  • 自己做电商网站.大连seo
  • wordpress表单拖拽建站优化推广
  • 网站链接如何做日历提醒seo技巧
  • 餐饮网络推广有哪些渠道seo面试常见问题及答案
  • 网站模板开发平台怎么做快速排名工具免费
  • 做外贸网站多少钱营销网站建设规划
  • 网站产品动效怎么做app001推广平台官网
  • 做外贸收费的网站百度seoo优化软件
  • 东莞58同城做网站电话百度下载电脑版
  • 公司网站设网络营销评价的名词解释
  • erp仓库管理系统seo导航站
  • wordpress安装时需要填写的使用者锦绣大地seo
  • 南宁网站制作平台外贸网站搭建推广
  • 网页游戏排行榜单传奇简述seo和sem的区别