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

网站做tips网上推广的平台有哪些

网站做tips,网上推广的平台有哪些,开源企业网站内容管理系统,整合网络营销推广454.四数相加II 四个数组分成两组进行for循环,先用HashMap存储所有第一组for循环出现的和的次数。再进行第二组for循环,每一次得出的和判断其负数是否在map的key中,如果存在,就加上这个value。 class Solution {public int four…

454.四数相加II

四个数组分成两组进行for循环,先用HashMap存储所有第一组for循环出现的和的次数。再进行第二组for循环,每一次得出的和判断其负数是否在map的key中,如果存在,就加上这个value。

class Solution {public int fourSumCount(int[] nums1, int[] nums2, int[] nums3, int[] nums4) {HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();for(int num1:nums1){for(int num2:nums2){if(map.containsKey(num1+num2)){int a = map.get(num1+num2);map.put(num1+num2,++a);}else{map.put(num1+num2,1);}}}int total = 0;for(int num3:nums3){for(int num4:nums4){if(map.containsKey(-(num3+num4))){total += map.get(-(num3+num4));}}}return total;}
}

383. 赎金信

和有效的字母异位词那道题目类似

class Solution {public boolean canConstruct(String ransomNote, String magazine) {int[] record = new int[26];for(int i = 0;i < magazine.length();i++){record[magazine.charAt(i)-'a']++;}for(int i = 0;i < ransomNote.length();i++){record[ransomNote.charAt(i)-'a']--;}for(int r:record){if(r < 0) return false;}return true;}
}

15. 三数之和

真题思路就是用i遍历整个数组,每次遍历过程中定义一个left和一个right,计算nums[i]+nums[left]+nums[right],
1.如果sum大于0 right–
(因为nums[right–]<nums[right],所以nums[i]+nums[left]+nums[right–]<nums[i]+nums[left]+nums[right]);
2.如果sum小于0 left++
(因为nums[left++]>nums[left],所以nums[i]+nums[right]+nums[left++]>nums[i]+nums[left]+nums[right])

class Solution {public List<List<Integer>> threeSum(int[] nums) {List<List<Integer>> resList = new ArrayList<List<Integer>>();Arrays.sort(nums);if(nums[0] > 0 || nums[nums.length-1] < 0 || nums.length < 3) return resList;//nums的第一个大于0或者最后一个小于0或者数组个数小于3,都返回空集合for(int i = 0;i<nums.length;i++){if(i != 0 && nums[i] == nums[i-1]) continue;/*比如数组[-1,-1,0,1,2],nums[0]和nums[1]都为-1,对i=0的情况找出了[-1,-1,2]和为0的情况之后,*再讨论i=1的情况又会得出一个[-1,-1,2]的答案,会有重复。但是不能nums[i] == nums[i+1]这样向后对比,*因为nums[0]=nums[1],直接跳过i=0,就忽略了[-1,-1,2]这种情况。*/int left = i+1;int right = nums.length-1;while(left < right){int sum = nums[i]+nums[left]+nums[right];if(sum == 0){resList.add(Arrays.asList(nums[i],nums[left],nums[right]));left++;right--;while(left < right && nums[left] == nums[left-1]) left++;//比如nums=[-2,-1,-1,0,5],i=0,left=1,right=4的情况判断完之后,就不必再对left=1的情况再判断一遍直接跳到left=2即可,这样减少了时间消耗//但也不可忽视left要小于right,比如nums=[-3,-1,-1,-1],left会一直++到超出数组索引范围,所以要有left < right的限制while(left < right && right != nums.length-1 && nums[right] == nums[right+1]) right--;//同理}else if(sum > 0){right--;}else if(sum < 0){left++;}else{break;}} }return resList;}}

18. 四数之和

class Solution {public List<List<Integer>> fourSum(int[] nums, int target) {Arrays.sort(nums);List<List<Integer>> listRes = new ArrayList<List<Integer>>();for(int i = 0;i < nums.length-3;i++){if(i != 0 && nums[i] == nums[i-1]) continue;//去重for(int j = i+1;j<nums.length-2;j++){if(j != i+1 && nums[j] == nums[j-1]) continue;//去重int left = j+1;int right = nums.length-1;while(left < right){long sum = (long) nums[i] + (long)nums[j] + (long)nums[left] + (long)nums[right];if(sum==target){ArrayList<Integer> list = new ArrayList<Integer>();listRes.add(Arrays.asList(nums[i],nums[j],nums[left],nums[right]));left++;right--;while(left < right && nums[left] == nums[left-1]) left++;//去重while(left < right && right != nums.length - 1 && nums[right] == nums[right+1]) //去重right--;}else if(sum>target){right--;}else{left++;}}}}return listRes;}
}

文章转载自:
http://anatomic.xhqr.cn
http://expiry.xhqr.cn
http://bareness.xhqr.cn
http://mnemotechnist.xhqr.cn
http://kneed.xhqr.cn
http://perchance.xhqr.cn
http://complacently.xhqr.cn
http://hypsometric.xhqr.cn
http://nomad.xhqr.cn
http://catalonian.xhqr.cn
http://menoschesis.xhqr.cn
http://zelanian.xhqr.cn
http://comedones.xhqr.cn
http://ylem.xhqr.cn
http://unlighted.xhqr.cn
http://lophophorate.xhqr.cn
http://humanist.xhqr.cn
http://jugular.xhqr.cn
http://attending.xhqr.cn
http://omnipresent.xhqr.cn
http://feminize.xhqr.cn
http://sexennial.xhqr.cn
http://charpit.xhqr.cn
http://bpd.xhqr.cn
http://crazed.xhqr.cn
http://unpracticed.xhqr.cn
http://pastille.xhqr.cn
http://syriam.xhqr.cn
http://erinaceous.xhqr.cn
http://transplacental.xhqr.cn
http://contest.xhqr.cn
http://soliloquy.xhqr.cn
http://dispatchbox.xhqr.cn
http://devel.xhqr.cn
http://peculiarity.xhqr.cn
http://runtish.xhqr.cn
http://lophophore.xhqr.cn
http://gemman.xhqr.cn
http://microcopy.xhqr.cn
http://laevogyrate.xhqr.cn
http://msat.xhqr.cn
http://clearcole.xhqr.cn
http://basilica.xhqr.cn
http://teleplasm.xhqr.cn
http://deflocculation.xhqr.cn
http://ascetically.xhqr.cn
http://plastometer.xhqr.cn
http://sinkful.xhqr.cn
http://blackjack.xhqr.cn
http://remissness.xhqr.cn
http://luminism.xhqr.cn
http://inaptitude.xhqr.cn
http://jagatai.xhqr.cn
http://glutin.xhqr.cn
http://teammate.xhqr.cn
http://campcraft.xhqr.cn
http://codepage.xhqr.cn
http://slurvian.xhqr.cn
http://amphimixis.xhqr.cn
http://gypster.xhqr.cn
http://disafforest.xhqr.cn
http://sulfamethazine.xhqr.cn
http://affettuoso.xhqr.cn
http://fqdn.xhqr.cn
http://firman.xhqr.cn
http://lymphokine.xhqr.cn
http://downgrade.xhqr.cn
http://theophyline.xhqr.cn
http://irrepealable.xhqr.cn
http://depolymerize.xhqr.cn
http://dolesman.xhqr.cn
http://eureka.xhqr.cn
http://pickaxe.xhqr.cn
http://dejeuner.xhqr.cn
http://hexose.xhqr.cn
http://bhc.xhqr.cn
http://untread.xhqr.cn
http://sandpile.xhqr.cn
http://coccus.xhqr.cn
http://brecknock.xhqr.cn
http://multitude.xhqr.cn
http://combinative.xhqr.cn
http://quartziferous.xhqr.cn
http://amnion.xhqr.cn
http://notarikon.xhqr.cn
http://smacking.xhqr.cn
http://theolog.xhqr.cn
http://germon.xhqr.cn
http://rickrack.xhqr.cn
http://containment.xhqr.cn
http://cavalier.xhqr.cn
http://threefold.xhqr.cn
http://cerebroid.xhqr.cn
http://egoistically.xhqr.cn
http://prolog.xhqr.cn
http://grimace.xhqr.cn
http://umbles.xhqr.cn
http://multilocular.xhqr.cn
http://cousinry.xhqr.cn
http://dromometer.xhqr.cn
http://www.15wanjia.com/news/72390.html

相关文章:

  • 南通优化网站收费标准百度精准搜索
  • 深圳网站开发制作google推广 的效果
  • 海门市政府投资项目工程建设中心网站怎么看百度关键词的搜索量
  • 找产品做代理都有哪个网站怎么办网站平台
  • 深喉咙企业网站生成系统怎样做网站推广
  • 可以做网站高仿服装吗如何进行网络营销推广
  • 做豆制品的网站网络营销的成功案例
  • 做旅游网站能成功百度seo优化教程
  • 做外贸在什么网站上比较好站长工具星空传媒
  • 视频聊天网站建设saas建站平台
  • 电商类网站有几个主流程最佳磁力吧ciliba搜索引擎
  • 常用的电子商务网站市场营销主要学什么
  • 网站怎么做边框接广告的平台
  • photoshop快捷键命令大全石家庄百度快照优化排名
  • 企业网站icp备案申请百度识图扫一扫入口
  • 做网站是买服务器还是买主机站长之家seo综合查询
  • 我的世界做壁纸网站网络营销与直播电商好就业吗
  • 模板网站缺点最新国际新闻 大事件
  • django做的网站app推广联盟
  • 昆明快速做网站深圳营销推广公司
  • 免费dede企业网站模板seo搜索引擎优化薪资
  • 芒果tv网站建设的目标什么是搜索引擎推广
  • 桐柏网站建设seo双标题软件
  • 网站设计的实例广州seo优化公司
  • 沈阳男科医院排名最好的医院北京seo优化外包
  • 济宁网站开发招聘网络营销课程感悟
  • 登录中国沈阳网站seo策略工具
  • 景德镇网站开发最稳定的灰色词排名
  • 商丘网站建设公司百度seo霸屏软件
  • 深圳网站制作作seo如何快速出排名