Google Telephonic interview question
3209

I work at Amazon for 2 years and had my telephonic interview today. This was the question I was asked :

There is an 2-d array filled with 'T' and 'L'. Cell with 'T' represents land while cell with 'L' represents water. If there is a land locked water then it will counted as land area. Land locked means it is surrounded by land for all 4 sides. Find the area of largest connected land.

Edge cases : For example let's assume following array :

TTTF
TFTT
TTTF
FFFF

Area of largest connected land is 10. Cell with co-ordinates 1,1 is counted in land area as it is land locked.

Another example :

TTTT
TFFF

Area for this is 5. Cells with water are not land locked here.

Hope this post will help you!

Comments (13)