1.二维数组中的查找 本题掌握思想:查找的过程实际是排除的过程 解法一:一次排除一行 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(target < array[i][j]){ j--; }else if(target > array[i][j]){ i++; }else{ return true; } } return false; } } 解法二:直接查找 public class Solution { public boolean Find(int target, int [][] array) { for(int i = 0;i < array.length;i++){ for(int j = 0;j < array[i].length;j++){ if(array[i][j] == target){ return...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile