Skip to content

Commit ddf3fb9

Browse files
committed
数组查找
1 parent 01db0e6 commit ddf3fb9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.blankj.easy._002;
2+
3+
/**
4+
* Created by liaoyao on 2017/11/2.
5+
*/
6+
public class Solution {
7+
public boolean Find(int target,int [][] array) {
8+
int len = array.length-1;
9+
int i = 0;
10+
while((len >= 0)&& (i < array[0].length)){
11+
if(array[len][i] > target){
12+
len--;
13+
}else if(array[len][i] < target){
14+
i++;
15+
}else{
16+
return true;
17+
}
18+
}
19+
return false;
20+
}
21+
}

0 commit comments

Comments
 (0)