题解 | #二维数组中的查找#
二维数组中的查找
http://www.nowcoder.com/practice/abc3fe2ce8e146608e868a70efebf62e
public class Solution { public boolean Find(int target, int [][] array) { int i = 0; int j = array[0].length - 1; while(i < array.length && j >=0){ if(array[i][j] == target){ return true; }else if(array[i][j] > target){ j --; }else { i ++; } } return false;
}
}
我居南半坡 文章被收录于专栏
多刷题,积蓄力量,欢迎讨论