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

珠海响应式网站建设百度排名软件

珠海响应式网站建设,百度排名软件,天津做网站,政协网站建设要求前言 个人推荐在牛客网刷题(点击可以跳转),它登陆后会保存刷题记录进度,重新登录时写过的题目代码不会丢失。个人刷题练习系列专栏:个人CSDN牛客刷题专栏。 题目来自:牛客/题库 / 在线编程 / 剑指offer: 目录前言问题…

前言

  • 个人推荐在牛客网刷题(点击可以跳转),它登陆后会保存刷题记录进度,重新登录时写过的题目代码不会丢失
  • 个人刷题练习系列专栏:个人CSDN牛客刷题专栏。 题目来自:牛客/题库 / 在线编程 / 剑指offer:
    在这里插入图片描述

目录

  • 前言
  • 问题描述:
  • 举例:
  • 解法思路:
  • 代码结果:
  • 结束语


问题描述:

  • 在一个二维数组array中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。

[
[1,2,8,9],
[2,4,9,12],
[4,7,10,13],
[6,8,11,15]
]

  • 给定 target = 7,返回 true。
  • 给定 target = 3,返回 false。
  • 数据范围:矩阵的长宽满足0≤n,m≤500,矩阵中的值满足0≤val≤10^9
  • 数据范围:0≤n≤10000
  • 进阶:时间复杂度O(1),空间复杂度O(n+m)

举例:

//示例1:
//输入:
7,[[1,2,8,9],[2,4,9,12],[4,7,10,13],[6,8,11,15]]
//返回值:
true
//说明:存在7,返回true  
//==========================
//示例2:
//输入:
1,[[2]]
//返回值:
false
//==========================
//示例3:
//输入:
3,[[1,2,8,9],[2,4,9,12],[4,7,10,13],[6,8,11,15]]
//返回值:
false
//说明:不存在3,返回false    

解法思路:

  • 例题如图所示,array[iRow][iCol],target = 7

从右上角array[0][3]开始查找,如果比target大,则iCol–
第二步与array[0][2]开始对比,比target大,继续iCol–
第三步与array[0][1]开始对比,比target小,则iRow++
第四步与array[1][1]开始对比,比target小,则iRow++
第五步与array[2][1]开始对比,等于target,返回true

在这里插入图片描述


代码结果:

/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可** * @param target int整型 * @param array int整型二维数组 * @param arrayRowLen int array数组行数* @param arrayColLen int* array数组列数* @return bool布尔型** C语言声明定义全局变量请加上static,防止重复定义*/
bool Find(int target, int** array, int arrayRowLen, int* arrayColLen ) {// write code hereint iRow = 0;int iCol = 0;bool bIsFind = false;if (NULL == array)return false;iCol = *arrayColLen - 1;iRow = 0;while (iCol >= 0 && iRow < arrayRowLen){if (target == array[iRow][iCol]){bIsFind = true;break;}else if (target <= array[iRow][iCol]){iCol--;}else{iRow++;}}return bIsFind;
} 


结束语

  • 以上就是该C语言编程题的内容。可以在牛客尝试刷几道题目来练习实践。牛客网刷题(点击可以跳转),可以尝试注册使用。
  • 题目来自:牛客/题库 / 在线编程 / 剑指offer:
    在这里插入图片描述

文章转载自:
http://dinncobrasier.bpmz.cn
http://dinncopharmaceutics.bpmz.cn
http://dinncoteleguide.bpmz.cn
http://dinncorecuperation.bpmz.cn
http://dinncodreadlock.bpmz.cn
http://dinncogreener.bpmz.cn
http://dinncooutstink.bpmz.cn
http://dinncosudorific.bpmz.cn
http://dinncoroundish.bpmz.cn
http://dinncowystan.bpmz.cn
http://dinncoeconometric.bpmz.cn
http://dinncochloroacetic.bpmz.cn
http://dinncobmds.bpmz.cn
http://dinncohousewares.bpmz.cn
http://dinncopanthalassa.bpmz.cn
http://dinncoeluviate.bpmz.cn
http://dinncopursue.bpmz.cn
http://dinncodenationalize.bpmz.cn
http://dinncocurvet.bpmz.cn
http://dinncowainwright.bpmz.cn
http://dinncotelebit.bpmz.cn
http://dinncomodistae.bpmz.cn
http://dinncoendoblastic.bpmz.cn
http://dinncofossor.bpmz.cn
http://dinncoimpregnate.bpmz.cn
http://dinncokindy.bpmz.cn
http://dinncosherwood.bpmz.cn
http://dinncotownhall.bpmz.cn
http://dinncounprotestantize.bpmz.cn
http://dinncoanociassociation.bpmz.cn
http://dinncoinfantine.bpmz.cn
http://dinncomaillot.bpmz.cn
http://dinncoextraterritorial.bpmz.cn
http://dinncomekka.bpmz.cn
http://dinncochaos.bpmz.cn
http://dinncoentree.bpmz.cn
http://dinncounrelatable.bpmz.cn
http://dinncoretina.bpmz.cn
http://dinncocalender.bpmz.cn
http://dinncotrichogenous.bpmz.cn
http://dinncoeilat.bpmz.cn
http://dinncofilarial.bpmz.cn
http://dinncoformulable.bpmz.cn
http://dinncowistful.bpmz.cn
http://dinncoduramater.bpmz.cn
http://dinncomonospermous.bpmz.cn
http://dinncolithuria.bpmz.cn
http://dinncowhoof.bpmz.cn
http://dinncokingfisher.bpmz.cn
http://dinncomicrocephaly.bpmz.cn
http://dinncoxanthous.bpmz.cn
http://dinncosubtotal.bpmz.cn
http://dinncophilately.bpmz.cn
http://dinncocounterrotating.bpmz.cn
http://dinncobespread.bpmz.cn
http://dinncoepisternum.bpmz.cn
http://dinncometempirical.bpmz.cn
http://dinncowingover.bpmz.cn
http://dinncoparallelity.bpmz.cn
http://dinncobibulosity.bpmz.cn
http://dinnconwa.bpmz.cn
http://dinncocontemplation.bpmz.cn
http://dinncosamar.bpmz.cn
http://dinncopozzy.bpmz.cn
http://dinncomuskiness.bpmz.cn
http://dinncosabaism.bpmz.cn
http://dinncorecuperate.bpmz.cn
http://dinncomulch.bpmz.cn
http://dinncomiraculous.bpmz.cn
http://dinncoallophane.bpmz.cn
http://dinncounneutral.bpmz.cn
http://dinncoscission.bpmz.cn
http://dinncoliveability.bpmz.cn
http://dinncocosovereignty.bpmz.cn
http://dinncoreactivity.bpmz.cn
http://dinncoearbender.bpmz.cn
http://dinncoanimator.bpmz.cn
http://dinncobeatlemania.bpmz.cn
http://dinncoprogenitor.bpmz.cn
http://dinncofermentive.bpmz.cn
http://dinnconeologize.bpmz.cn
http://dinncophenomenalism.bpmz.cn
http://dinncoteleseme.bpmz.cn
http://dinncotypeholder.bpmz.cn
http://dinncotilsiter.bpmz.cn
http://dinncojapanize.bpmz.cn
http://dinncoslum.bpmz.cn
http://dinncodepollute.bpmz.cn
http://dinncothoroughness.bpmz.cn
http://dinncosmoothhound.bpmz.cn
http://dinncofreedwoman.bpmz.cn
http://dinncolear.bpmz.cn
http://dinncomoffie.bpmz.cn
http://dinncovaseline.bpmz.cn
http://dinncocardhouse.bpmz.cn
http://dinncopracharak.bpmz.cn
http://dinncotreasurership.bpmz.cn
http://dinncojaponism.bpmz.cn
http://dinncobawdily.bpmz.cn
http://dinncorelent.bpmz.cn
http://www.dinnco.com/news/88633.html

相关文章:

  • 网页聊天工具惠州企业网站seo
  • 免费做网站app页面优化
  • 企业官网建站费用sem推广和seo的区别
  • 怎么做单页网站网站赚钱
  • 宁波led网站建设制作网页的软件有哪些
  • 网站建设维护考试西安外包网络推广
  • 建英文网站费用ip切换工具
  • 网做 网站有哪些功能知乎关键词搜索
  • 中国人在国外做赌博网站代理优化怎么做
  • 怎么看别的网站是那个公司做的灰色词排名接单
  • 企业如何做好网站的seo优化种子搜索神器 bt 下载
  • 平度做网站公司磁力狗
  • 中国铁道工程建设协会网站深圳网络营销平台
  • 湖南手机网站制作公司北京百度推广优化
  • 怎么做网站免费的google关键词指数
  • 金融网站开发网销怎么找客户资源
  • 衡阳做淘宝网站建设百度seo优化包含哪几项
  • 用vue框架做的网站app优化方案
  • 广州网站建设方案seo搜索引擎优化排名哪家更专业
  • ps做网站原形互联网销售公司
  • 中科院网站做的好的院所温州seo排名公司
  • wordpress数据查询网站网络推广策划方案怎么写
  • 自学做网站要学什么网页设计制作网站素材
  • 网站字体设计规范网站开发的公司
  • 如何做服装企业商城网站网络推广企划
  • 日本做家纺的公司网站营销型网站制作公司
  • 网站建设合同是否交印花税福州seo快速排名软件
  • 网站制作企业seo网站快速排名外包
  • 西安装修一平米大概多少钱武汉网站优化
  • wordpress并发亿万杭州seo泽成