Easy
Given a binary grid where 1 is land and 0 is water, return the total perimeter of the land. Each land cell contributes one unit of perimeter for every edge that borders water or the grid boundary.
Input: grid = [[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]] Output: 16
Input: grid = [[1]] Output: 4