Compute maximum perimeter among islands | Snapchat Interview Question