Write an efficient algorithm that searches for a value in an m x n matrix. The matrix has the following properties: integers in each row are sorted from left to right. The first integer of each row is greater than the last integer fo the previous row