Minimum Depth and Search 2D Matrix solutions.