Amazon Robotics interview question

To find connected components on a 2D matrix.