当前位置:网站首页>15、判断二维数组中是否存在目标值
15、判断二维数组中是否存在目标值
2022-07-28 09:58:00 【[email protected]】

public boolean findNumberIn2DArray(int[][] matrix, int target) {
int i = matrix.length - 1, j = 0;
while(i >= 0 && j < matrix[0].length) {
if(matrix[i][j] > target) i--;
else if(matrix[i][j] < target) j++;
else return true;
}
return false;
}
思路详见纸上

版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zjj1910066023/article/details/124855861
边栏推荐
- 21. 合并两个有序链表
- B2B2C系统亮点是什么?如何助力珠宝首饰企业打造全渠道多商户商城管理体系
- OSPF expansion configuration, routing principles, anti ring and re release
- 【JZOF】14剪绳子
- arthas使用教程
- JWT 登录认证 + Token 自动续期方案,写得太好了!
- 海量数据TopN问题
- Choosing a supplier service system is the first step for large health industry enterprises to move towards digital transformation
- IE兼容性问题处理
- 基于ModelArts续写最伟大的作品【玩转华为云】
猜你喜欢

Data can't lie. Plato farm is the leader of the meta universe

为报复公司解雇,我更改了项目的所有代码注释!

Thinking and summary of technical personnel | R & D Efficiency

LSA and optimization of OSPF
![[ESP32][esp-idf][LVGL7.9] 使用oled iic编译失败](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)
[ESP32][esp-idf][LVGL7.9] 使用oled iic编译失败

It's settled! On July 30!

【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03

OSPF expansion configuration, routing principles, anti ring and re release

医药行业数字化建设,箭在弦上

ES(8.1)认证题目
随机推荐
剑指offer
Tencent technical experts: decrypt the 100 million user products wechat, QQ, King glory... Comprehensively practice on the cloud!
【JZOF】15二进制中1的位数
Introduction to thresholdfilter
Introduction to evaluatorfilter
leetcode076——数组中的第 k 大的数字
(10) Defer keyword
Boss: there are too many systems in the company. Can we realize account interworking?
The blind box of super primitive series will be launched soon, and platofarm will enable more rights and interests
Prometheus operation and maintenance tool promtool (IV) TSDB function
Illustrate three mainstream enterprise architecture models (recommended collection!)
PHP生成二维码(学习)
[openharmony] [rk2206] build openharmony compiler (2)
19. 删除链表的倒数第 N 个结点
LSA and optimization of OSPF
[ESP32][esp-idf] esp32s3快速搭建LVGLV7.9
第四步-用户开发环境设置
Read Plato farm's eplato and the reason for its high premium
排序——快速排序(快慢指针实现)
JS promotion: the underlying principle of flat tiling