solution to Search a 2D Matrix