@@ -0,0 +1,1217 @@
+package dfs;%0A%0A/**%0A * Created by Yue on 2017/10/24.%0A * leetcode no.695 %E6%B7%B1%E5%BA%A6%E4%BC%98%E5%85%88%0A */%0Apublic class MaxAreaOfIsland %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        int%5B%5D%5B%5D grid = new int%5B%5D%5B%5D %7B%0A                %7B0,0,1,0,0,0,0,1,0,0,0,0,0%7D,%0A                %7B0,0,0,0,0,0,0,1,1,1,0,0,0%7D,%0A                %7B0,1,1,0,1,0,0,0,0,0,0,0,0%7D,%0A                %7B0,1,0,0,1,1,0,0,1,0,1,0,0%7D,%0A                %7B0,1,0,0,1,1,0,0,1,1,1,0,0%7D,%0A                %7B0,0,0,0,0,0,0,0,0,0,1,0,0%7D,%0A                %7B0,0,0,0,0,0,0,1,1,1,0,0,0%7D,%0A                %7B0,0,0,0,0,0,0,1,1,0,0,0,0%7D%0A        %7D;%0A        System.out.println(maxAreaOfIsland(grid));%0A    %7D%0A%0A    public static int area(int%5B%5D%5B%5D grid, int r, int c) %7B%0A        if (r %3E= 0 && r %3C grid.length && c %3E= 0 && c %3C grid%5B0%5D.length && grid%5Br%5D%5Bc%5D == 1) %7B%0A            grid%5Br%5D%5Bc%5D = 0;%0A            return 1 + area(grid, r + 1, c) + area(grid, r - 1, c) + area(grid, r, c - 1) + area(grid, r, c + 1);%0A        %7D%0A        return 0;%0A    %7D%0A%0A    public static int maxAreaOfIsland(int%5B%5D%5B%5D grid) %7B%0A        int res = 0;%0A        for (int r = 0; r %3C grid.length; r++) %7B%0A            for (int c = 0; c %3C grid%5B0%5D.length; c++)%0A                res = Math.max(res, area(grid, r, c));%0A        %7D%0A        return res;%0A    %7D%0A%0A%7D%0A

add leetcode no.695