solve search 2d matrix