O(nlogn) solution in Java


  • 0
    C
    public class Solution {
        public boolean searchMatrix(int[][] matrix, int target) {
            for(int i=0; i< matrix.length; i++){
                if(Arrays.binarySearch(matrix[i], target) >= 0) return true;
            }
            return false;
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.