@@ -0,0 +1,1158 @@
+/**%0A *You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). The island doesn't have %22lakes%22 (water inside that isn't connected to the water around the island). One cell is a square with side length 1. The grid is rectangular, width and height don't exceed 100. Determine the perimeter of the island.%0A *%0A *Example:%0A *%0A *%5B%5B0,1,0,0%5D,%0A * %5B1,1,1,0%5D,%0A * %5B0,1,0,0%5D,%0A * %5B1,1,0,0%5D%5D%0A *%0A *Answer: 16%0A */%0Aclass Solution %7B%0A    public int islandPerimeter(int%5B%5D%5B%5D grid) %7B%0A        int islands = 0, neighbors = 0;%0A        for (int i = 0; i %3C grid.length; i++)%0A            for (int j = 0; j %3C grid%5Bi%5D.length; j++) %7B%0A                if (grid%5Bi%5D%5Bj%5D == 1) %7B%0A                    islands++;%0A                    if (i %3C grid.length - 1 && grid%5Bi + 1%5D%5Bj%5D == 1) neighbors++;%0A                    if (j %3C grid%5Bi%5D.length - 1 && grid%5Bi%5D%5Bj + 1%5D == 1) neighbors++;%0A                %7D%0A            %7D%0A        return islands * 4 - neighbors * 2;%0A    %7D%0A%7D%0A

Create IslandPerimeter.java