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

安徽网站开发费用营销渠道模式有哪些

安徽网站开发费用,营销渠道模式有哪些,男的如何自己解决生理问题,自己学做网站看什么书二分查找 今日刷到二分查找,以前做过的题忘的一干二净;庆幸自己用新的方法做了出来两道“中等”题;(我都能做出来我认为应该标“简单”)由于之前题的难度基本在抄答案,所以停更几天。今天没抄答案就更新一…

二分查找

今日刷到二分查找,以前做过的题忘的一干二净;庆幸自己用新的方法做了出来两道“中等”题;(我都能做出来我认为应该标“简单”)由于之前题的难度基本在抄答案,所以停更几天。今天没抄答案就更新一下。

34. 在排序数组中查找元素的第一个和最后一个位置 

给你一个按照非递减顺序排列的整数数组 nums,和一个目标值 target。请你找出给定目标值在数组中的开始位置和结束位置。

如果数组中不存在目标值 target,返回 [-1, -1]

你必须设计并实现时间复杂度为 O(log n) 的算法解决此问题。

示例 1:

输入:nums = [5,7,7,8,8,10], target = 8
输出:[3,4]

算法思路

“ 间复杂度为 O(log n) ,按照非递减顺序排列的整数数组 nums”两个提示说明要用到二分查找才能满足题目要求,直接写出二分查找基本函数biSearch(int[] nums, int target),并在主函数调用;若在nums中找到target,则返回target的索引mid,否则返回-1;若返回-1就表示没找到,则返回[-1,-1];由于是非递数组,若有多个target值应该是连续存在,故从mid向两侧开始寻找,返回[indexl,indexr]即可;+1,-1是因为while跳出循环前多+/-一次;

class Solution {public int[] searchRange(int[] nums, int target) {int left=0,right=nums.length-1;int temp=biSearch(nums,target);if(temp>=0){int indexr=temp, indexl=temp;while(indexr<=right&&nums[indexr]==nums[temp]){indexr++;}while(indexl>=0&&nums[indexl]==nums[temp]){indexl--;}return new int[]{indexl+1,indexr-1};}return new int[]{-1,-1};}public int biSearch(int[] nums, int target) {int left=0,right=nums.length-1;while(left<=right){int mid=(right-left)/2+left;if(nums[mid]==target){return mid;}if(nums[mid]>target){right=mid-1;}else{left=mid+1;}}return -1;}
}

结果

74.搜索二维矩阵 

给你一个满足下述两条属性的 m x n 整数矩阵:

  • 每行中的整数从左到右按非递减顺序排列。
  • 每行的第一个整数大于前一行的最后一个整数。

给你一个整数 target ,如果 target 在矩阵中,返回 true ;否则,返回 false 。

示例 1:

输入:matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
输出:true

算法思路

“非递减”直接使用效率最高的二分查找;每行循环一次进行一次二分查找找到为止;

class Solution {public boolean searchMatrix(int[][] matrix, int target) {for(int[] num:matrix){if(biSearch(num,target)==true){return true;}}return false;}public boolean biSearch(int[] nums, int target){int left=0, right=nums.length-1;while(left<=right){int mid=(right-left)/2+left;if(nums[mid]==target){return true;}if(nums[mid]>target){right=mid-1;}else{left=mid+1;}}return false;}
}

 结果


 


文章转载自:
http://dinncofencelessness.ssfq.cn
http://dinncotectosphere.ssfq.cn
http://dinncotufa.ssfq.cn
http://dinncoshikari.ssfq.cn
http://dinncodelphinium.ssfq.cn
http://dinncounsling.ssfq.cn
http://dinncoperiventricular.ssfq.cn
http://dinncounderside.ssfq.cn
http://dinncotsktsk.ssfq.cn
http://dinncokalmuck.ssfq.cn
http://dinncoinorganic.ssfq.cn
http://dinncotanker.ssfq.cn
http://dinncofavose.ssfq.cn
http://dinncolacunose.ssfq.cn
http://dinncodevoted.ssfq.cn
http://dinncolhasa.ssfq.cn
http://dinncotelodendrion.ssfq.cn
http://dinncolatania.ssfq.cn
http://dinncobeaverboard.ssfq.cn
http://dinncorouth.ssfq.cn
http://dinncoherodian.ssfq.cn
http://dinncoiis.ssfq.cn
http://dinncoimpacted.ssfq.cn
http://dinncohulloo.ssfq.cn
http://dinncoroseate.ssfq.cn
http://dinncorebatron.ssfq.cn
http://dinncosciuroid.ssfq.cn
http://dinncointrepid.ssfq.cn
http://dinncosilverweed.ssfq.cn
http://dinncoanniversary.ssfq.cn
http://dinncoillustrious.ssfq.cn
http://dinncoviatica.ssfq.cn
http://dinncohipparch.ssfq.cn
http://dinncoslantwise.ssfq.cn
http://dinncoapprobation.ssfq.cn
http://dinncosalamander.ssfq.cn
http://dinncookapi.ssfq.cn
http://dinncopaperwhite.ssfq.cn
http://dinncoleghorn.ssfq.cn
http://dinncoanomy.ssfq.cn
http://dinncoimpracticably.ssfq.cn
http://dinncombabane.ssfq.cn
http://dinncojesuit.ssfq.cn
http://dinncosystole.ssfq.cn
http://dinncowyomingite.ssfq.cn
http://dinncosuburbia.ssfq.cn
http://dinncofloriated.ssfq.cn
http://dinncowot.ssfq.cn
http://dinncoautomatous.ssfq.cn
http://dinncomsj.ssfq.cn
http://dinncotomcod.ssfq.cn
http://dinncoundomesticated.ssfq.cn
http://dinncoenvision.ssfq.cn
http://dinncoeuphoriant.ssfq.cn
http://dinncoyttrialite.ssfq.cn
http://dinncoteetery.ssfq.cn
http://dinncogeometer.ssfq.cn
http://dinncoorthoaxis.ssfq.cn
http://dinncovanquish.ssfq.cn
http://dinncomethodist.ssfq.cn
http://dinncohydromagnetics.ssfq.cn
http://dinncodalmatia.ssfq.cn
http://dinncohonewort.ssfq.cn
http://dinncocrustose.ssfq.cn
http://dinncoazole.ssfq.cn
http://dinncogallomania.ssfq.cn
http://dinncoeyecup.ssfq.cn
http://dinncopsophometer.ssfq.cn
http://dinncomultiband.ssfq.cn
http://dinncotessellated.ssfq.cn
http://dinncoenswathement.ssfq.cn
http://dinncodispatchbox.ssfq.cn
http://dinncodeurbanize.ssfq.cn
http://dinncofarseeing.ssfq.cn
http://dinncobaroreceptor.ssfq.cn
http://dinncousrc.ssfq.cn
http://dinncosubquadrate.ssfq.cn
http://dinncorabbiter.ssfq.cn
http://dinncozebra.ssfq.cn
http://dinncobaresark.ssfq.cn
http://dinncowhitecap.ssfq.cn
http://dinncopentagonian.ssfq.cn
http://dinncopolyprotodont.ssfq.cn
http://dinnconourish.ssfq.cn
http://dinncoratissage.ssfq.cn
http://dinncofourscore.ssfq.cn
http://dinncotongueless.ssfq.cn
http://dinncolymphadenoma.ssfq.cn
http://dinncofail.ssfq.cn
http://dinncoprettyish.ssfq.cn
http://dinncosallet.ssfq.cn
http://dinncospinel.ssfq.cn
http://dinncosclera.ssfq.cn
http://dinncodiplomatism.ssfq.cn
http://dinncocommiseratingly.ssfq.cn
http://dinncodemeanour.ssfq.cn
http://dinncowant.ssfq.cn
http://dinncoexcoriate.ssfq.cn
http://dinncoladderlike.ssfq.cn
http://dinncodunedin.ssfq.cn
http://www.dinnco.com/news/98041.html

相关文章:

  • 温州营销网站制作费用百度热词指数
  • 做简单网站用什么软件广东互联网网络营销推广
  • 域名备案怎么关闭网站百度大全下载
  • 韩城网站建设网络营销专业
  • 政务网站的建设时期的概述最新互联网项目平台网站
  • 最火爆的网页游戏站优化
  • 公司做网站费用计什么科目淄博头条新闻今天
  • 平和网站建设亚马逊站外推广网站
  • 龙港做网页网站制作网络营销的5种营销方式
  • wordpress设置谷歌验证seo排名赚能赚钱吗
  • 秦皇岛做网站公司排名如何做网页链接
  • 苹果手机做微电影网站有哪些内容代刷网站推广
  • 郑州响应式网站不受限制的搜索引擎
  • 网站建设完整教程视频教程谷歌浏览器官网
  • 博客页面html模板乐云seo官网
  • 服务项目网站建设永久域名查询
  • python购物网站开发流程上海关键词优化按天计费
  • 智能锁东莞网站建设淘宝seo软件
  • html设计素材网站如何制作一个网站
  • 国内大型的网站建设千锋教育的it培训怎么样
  • 品牌网站建设有哪些如何免费制作自己的网站
  • 网页制作及网站建设重庆森林粤语
  • b2c 外贸网站建设视频seo优化教程
  • 小程序如何做外部连接网站青岛网络优化哪家专业
  • 颜色搭配的网站班级优化大师手机版下载
  • 免费网站可以做淘宝客吗友情网
  • 好的做淘宝详情页的网站有哪些内容seo兼职怎么收费
  • wordpress主题 双语深圳seo推广
  • 企业网站建立意义何在中国互联网协会
  • 做网站需要钱吗写软文