public int findLongestContinuous(int[][] array) {
        if (array == null || array.length == 0 || array[0].length == 0) return 0;
        int[][] dp = new int[array.length][array[0].length];
        int max = 0;
        for (int i = 0; i < array.length; ++i) {
            for (int j = 0; j < array[0].length; ++j) {
                if (dp[i][j] == 0) {
                    dfs(array, dp, i, j);
                }
                if (dp[i][j] > max) max = dp[i][j];
            }
        }
        return max;
    }