package leetcode;

/**
 * https://leetcode.com/problems/search-a-2d-matrix-ii/
 */
public class Problem240 {
    public boolean searchMatrix(int[][] matrix, int target) {
        return false;
    }
    
    public static void main(String[] args) {
        Problem240 prob = new Problem240();
        int[][] matrix = new int[][] {
            new int[]{ 1,  4,  7, 11, 15},
            new int[]{ 2,  5,  8, 12, 19},
            new int[]{ 3,  6,  9, 16, 22},
            new int[]{10, 13, 14, 17, 24},
            new int[]{18, 21, 23, 26, 30}
        };
        System.out.println(prob.searchMatrix(matrix, 5)); // true
        System.out.println(prob.searchMatrix(matrix, 20)); // false
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -202,373 +202,129 @@
     
-return false;%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        Problem240 prob = new Problem240();%0A        int%5B%5D%5B%5D matrix = new int%5B%5D%5B%5D %7B%0A            new int%5B%5D%7B 1,  4,  7, 11, 15%7D,%0A            new int%5B%5D%7B 2,  5,  8, 12, 19%7D,%0A            new int%5B%5D%7B 3,  6,  9, 16, 22%7D,%0A            new int%5B%5D%7B10, 13, 14, 17, 24%7D,%0A            new int%5B%5D%7B18, 21, 23, 26, 30
+for (int%5B%5D a : matrix) %7B%0A            if (Arrays.binarySearch(a, target) %3E= 0) %7B%0A                return true;%0A            
 %7D%0A  
@@ -330,17 +330,16 @@
        %7D
-;
 %0A       
@@ -343,133 +343,21 @@
     
-System.out.println(prob.searchMatrix(matrix, 5)); // true%0A        System.out.println(prob.searchMatrix(matrix, 20)); //
+return
  false
+;
 %0A   

Solve problem 240