package leetcode;

/**
 * https://leetcode.com/problems/shortest-bridge/
 */
public class Problem934 {
    public int shortestBridge(int[][] A) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem934 prob = new Problem934();
        System.out.println(prob.shortestBridge(new int[][]{
            {0, 1},
            {1, 0}
        })); // 1
        System.out.println(prob.shortestBridge(new int[][]{
            {0, 1, 0},
            {0, 0, 0},
            {0, 0, 1}
        })); // 2
        System.out.println(prob.shortestBridge(new int[][]{
            {1, 1, 1, 1, 1},
            {1, 0, 0, 0, 1},
            {1, 0, 1, 0, 1},
            {1, 0, 0, 0, 1},
            {1, 1, 1, 1, 1}
        })); // 1
    }
}

@@ -151,33 +151,718 @@
     
-// TODO%0A        return 0;
+int maxRow = A.length;%0A        int maxCol = maxRow %3E 0 ? A%5B0%5D%5B0%5D : 0;%0A        boolean%5B%5D%5B%5D visited = new boolean%5BmaxRow%5D%5BmaxCol%5D;%0A        for (int row = 0; row %3C maxRow; row++) %7B%0A            for (int col = 0; col %3C maxCol; col++) %7B%0A                if (visited%5Brow%5D%5Bcol%5D) %7B%0A                    continue;%0A                %7D%0A                // TODO%0A            %7D%0A        %7D%0A        return 0;%0A    %7D%0A%0A    private static void shortest(int%5B%5D%5B%5D a, int maxRow, int maxCol, int row, int col) %7B%0A        // top%0A        if (row - 1 %3E= 0) %7B%0A%0A        %7D%0A        // right%0A        if (col + 1 %3C maxCol) %7B%0A%0A        %7D%0A        // bottom%0A        if (row + 1 %3C maxRow) %7B%0A%0A        %7D%0A        // left%0A        if (col - 1 %3E= 0) %7B%0A%0A        %7D
 %0A   
@@ -1269,32 +1269,178 @@
 ge(new int%5B%5D%5B%5D%7B%0A
+            %7B0, 1, 1%7D,%0A            %7B0, 0, 0%7D,%0A            %7B1, 1, 0%7D%0A        %7D)); // 1%0A        System.out.println(prob.shortestBridge(new int%5B%5D%5B%5D%7B%0A
             %7B1, 

Update problem 934