Python 3: DFS || 96%
```\nclass Solution:\n    def largestIsland(self, grid: list[list[int]]) -> int:\n        border=defaultdict(set)   # coor of border 0 mapping to area id. (r,c)
```\nclass Solution:\n    def largestIsland(self, grid: list[list[int]]) -> int:\n        border=defaultdict(set)   # coor of border 0 mapping to area id. (r,c) -> id\n        n=len(grid)\n        seen=[[False]*n for _ in range(n)]\n\n        def dfs(r,c,id):\n            seen[r][c]=True\n            area=1\n            for x,y in ((r+1,c),(r-1,c),(r,c+1),(r,c-1)):\n                if 0<=x<n and 0<=y<n:\n                    if grid[x][y]==0:\n                        border[(x,y)].add(id)\n                    elif grid[x][y]==1 and not seen[x][y]:\n                        area+=dfs(x,y,id)\n            return area\n\n        areas=[]\n        id=0\n        for i in range(n):\n            for j in range(n):\n                if grid[i][j]==1 and not seen[i][j]:\n                    areas.append(dfs(i,j,id))\n                    id+=1\n        \n        if border:\n            return max(1+sum(areas[x] for x in y) for y in border.values())\n        else:\n            return n*n if grid[0][0]==1 else 1\n
['Depth-First Search', 'Python']