剑指Offer 3题 二维数组中的查找 Java
来源:互联网 发布:retrofit post传json 编辑:程序博客网 时间:2024/05/04 13:23
package test;public class FindNumber {public boolean findNumber(int[][] matrix, int rows, int columns, int number){boolean found = false;if(matrix != null && rows > 0 && columns > 0){int row = 0;int column = columns-1;while(row < rows && column > 0){if(matrix[row][column] == number){found = true;break;}else if(matrix[row][column] >number){column--;}else{row++;}}}return found;}public static void main(String[] args) {// TODO Auto-generated method stubint[][] datas = {{1,2,8,9},{2,4,9,12},{4,7,10,13},{6,8,11,15}};FindNumber findNumber = new FindNumber();boolean b = findNumber.findNumber(datas, datas.length, datas[0].length, 7);System.out.println(b);}}
0 0
- 剑指Offer 3题 二维数组中的查找 Java
- 剑指offer--二维数组中的查找 java
- 剑指offer:二维数组中的查找(java)
- [剑指Offer]二维数组中的查找[java]
- 剑指offer题目3-二维数组中的查找(JAVA实现)
- 剑指offer 3题 【数组】二维数组中的查找
- 剑指offer:3-二维数组中的查找
- 剑指offer-3 二维数组中的查找
- 剑指offer 3 -二维数组中的查找
- 剑指offer:3-二维数组中的查找
- 剑指Offer-3-二维数组中的查找
- 剑指Offer 3 二维数组中的查找
- 【剑指Offer】3:二维数组中的查找
- 剑指offer---二维数组中的查找(3)
- 剑指offer面试题java实现之题3:二维数组中的查找
- 剑指Offer—— 题3 二维数组中的查找 Java版
- 剑指offer算法 java实现 二维数组中的查找
- JAVA实现二维数组中的查找(《剑指offer》)
- awk+system+getline
- Basic Data Structurek(模拟,双向队列)
- C++复习
- 秋天SWF生成PDF免费版V1.4
- hdu 5929 Basic Data Structure 双端队列
- 剑指Offer 3题 二维数组中的查找 Java
- 选择想要出现的图片张数
- Jekyll和Github搭建个人静态博客
- Linux内存寻址之一:内存地址分类以及MMU介绍
- Java集合——TreeMap源码详解
- Python基础(九)——输入输出
- 利用数码管显示的时钟
- dedecms分页标题长度修改
- 2016弱校联盟十一专场10.5(12点场) Increasing or Decreasing