You are given a grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. The grid is surrounded by water and contains exactly one island, which is a group of connected land cells. The island doesn't have lakes, meaning the water inside isn't connected to the water around the island. Each cell is a 1x1 square. Determine the perimeter of the island.
Click Run to execute sample tests.