Domanda di colloquio di Amazon

Calculated how many connected components in a grid.