Created
December 31, 2017 11:47
-
-
Save tamlt2704/6ab01a35214fee2f75e7659adbc9d2a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #https://leetcode.com/problems/island-perimeter/description/ | |
| class Solution(object): | |
| def islandPerimeter(self, grid): | |
| """ | |
| :type grid: List[List[int]] | |
| :rtype: int | |
| """ | |
| return sum(sum(map(operator.ne, [0] + row, row + [0])) | |
| for row in grid + map(list, zip(*grid))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment