标签:
1 public class Solution { 2 3 public boolean Find(int[][] array,int target) { 4 5 for(int i = 0; i < array.length; i++){ 6 for(int j = 0; j < array[i].length; j++){ 7 if(array[i][j] == target){ 8 return true; 9 } 10 } 11 } 12 return false; 13 } 14 15 public static void main(String[] args) { 16 int[][] array = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; 17 18 int target = 15; 19 Solution solution = new Solution(); 20 boolean b = solution.Find(array, target); 21 System.out.println(b); 22 } 23 }
标签:
原文地址:http://www.cnblogs.com/wangchaoyuan/p/5958947.html