EASY JAVA Solution : 🔥
Java Code\n\nclass Solution {\n    int[] xDir = {0,0,-1,1};\n    int[] yDir = {-1,1,0,0};\n    public int DFS(int[][] grid,int i,int j,int var)\n    {\n        
# Java Code\n```\nclass Solution {\n    int[] xDir = {0,0,-1,1};\n    int[] yDir = {-1,1,0,0};\n    public int DFS(int[][] grid,int i,int j,int var)\n    {\n        grid[i][j] = var;\n        int count = 1;\n        for(int k = 0;k<4;k++)\n        {\n            int newRow = i+xDir[k];\n            int newCol = j+yDir[k];\n            if(newRow>=0 && newRow<grid.length && newCol>=0 && newCol<grid[0].length && grid[newRow][newCol] == 1)\n            {\n                count+=DFS(grid,newRow,newCol,var);\n            }\n        }\n        return count;\n    }\n    public int largestIsland(int[][] grid) {\n        int islands = 0;\n        int var = -1;\n        HashMap<Integer,Integer> hmap = new HashMap<>();\n        for(int i = 0;i<grid.length;i++)\n        {\n            for(int j = 0;j<grid[0].length;j++)\n            {\n                if(grid[i][j] == 1)\n                {\n                    int area = DFS(grid,i,j,var);\n                    hmap.put(var,area);\n                    var--;\n                }\n            }\n        }\n        boolean zero = false;\n        int maxArea = Integer.MIN_VALUE;\n        for(int i = 0;i<grid.length;i++)\n        {\n            for(int j = 0;j<grid[0].length;j++)\n            {\n                if(grid[i][j] == 0)\n                {\n                    zero = true;\n                    HashSet<Integer> hset = new HashSet<>();\n                    int area = 1;\n                    for(int k = 0;k<4;k++)\n                    {\n                        int newRow = i+xDir[k];\n                        int newCol = j+yDir[k];\n                        if(newRow >= 0 && newRow<grid.length && newCol >= 0 && newCol<grid[0].length)\n                        {\n                            hset.add(grid[newRow][newCol]);\n                        }\n                    }\n                    for(int item : hset)\n                    {\n                        if(item != 0)\n                            area += hmap.get(item);\n                    }\n                    maxArea = Math.max(maxArea,area);\n                }\n            }   \n        }\n        return (zero == true)?maxArea:hmap.get(-1);\n    }\n}\n\n\n```\n---\n#### *Please don\'t forget to upvote if you\'ve liked my solution. \uD83D\uDC4D*
['Depth-First Search', 'Breadth-First Search', 'Python', 'C++', 'Java']