Skip to content

Commit 5e10742

Browse files
Merge pull request #2041 from CodingTestStudy2/최민지
[최민지] Day17
2 parents a27ad08 + ef54496 commit 5e10742

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎leetcode3/최민지/463.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def islandPerimeter(self, grid: list[list[int]]) -> int:
3+
answer = 0
4+
for i in range(0, len(grid)):
5+
for j in range(0, len(grid[0])):
6+
if grid[i][j] == 1:
7+
answer += 4
8+
if i < len(grid) -1 and grid[i+1][j] == 1:
9+
answer -= 2
10+
if j < len(grid[0]) -1 and grid[i][j+1] == 1:
11+
answer -= 2
12+
return answer

0 commit comments

Comments
 (0)