@Test(timeout = 2000)
  public void testCase4() {
    String[] wires = new String[] {"01000", "10100", "01010", "00100", "00000"};
    int[] gridConnections = new int[] {2, 4};

    int expected = 3;
    int actual = solution.maxNewWires(wires, gridConnections);

    Assert.assertEquals(expected, actual);
  }
  @Test(timeout = 2000)
  public void sysTestCase13() {
    String[] wires =
        new String[] {
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000100001001000000000",
          "00000000000000000000000100000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000100000001000000000000000",
          "00000000000000000000000000000100000000000000000000",
          "00000000000000000000000010000000000000000000000000",
          "00000000000000000000000011000000000000000000000000",
          "00000000000000010000000000000000000000000000000000",
          "00000000000000000000010000000001001000000011000000",
          "00000000000000100001000000000000000000001000000000",
          "00000000000000000000000000000000000000000000000100",
          "00000000000010000000000000000000000000000000000001",
          "00000000001000000000000000001000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000100001000000000010000000",
          "00000000000010000000001000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000100000000000000100000001000000001000000",
          "00000000000000000001000000000000000010000000000001",
          "00001000000000000000000000000000000100000000000000",
          "00000000110000000000000000000000000000000000000000",
          "00000000010000000000000000000000000000000000000000",
          "00000010000000000010010000000000000000000010000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000010000000000000000000000000000000000",
          "00000001000000000000000000000000000000000000000000",
          "00000000000000000000000000000000010000000000000000",
          "00000000000100000010000000000000000000000010000000",
          "00010000000000000000000000000000000000000000000010",
          "00000000000000000000000000000010000000000000000000",
          "00000010000100000000010000000000000000000000000000",
          "00000000000000000000000100000000000000000000000000",
          "00000000000000000000001000000000000001000000000000",
          "00010000000000000000000000000000000010000000000011",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00010000000010000000000000000000000000000100000001",
          "00000000000000000000000000000000000000001000000000",
          "00000000000100000010000000100001000000000000000000",
          "00000000000100000000010000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000001000000000000000000000000000000000000",
          "00000000000000000000000000000000100001000000000000",
          "00000000000000100000001000000000000001001000000000"
        };
    int[] gridConnections = new int[] {11, 16, 28, 4, 7, 24, 33, 41};

    int expected = 334;
    int actual = solution.maxNewWires(wires, gridConnections);

    Assert.assertEquals(expected, actual);
  }
  @Test(timeout = 2000)
  public void sysTestCase14() {
    String[] wires =
        new String[] {
          "00000000000000000000010000000000000000000000000000",
          "00000000000000000000000010000000000000000000000000",
          "00000000000000000000000000000001000000000000000100",
          "00000000000000000000000100000000000000000000000000",
          "00000000001000000001000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000100000000000010000000100000000000",
          "00001000000000000000000000010000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000001000",
          "00000000000000000000000000001000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000010000000000000000000001000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000010000000000000000000010000000000000000000",
          "00000000000000000000000000000000100000000000000000",
          "00001000000000000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "10000000000000010000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000000",
          "00010000000000000000000000000000000000000000000000",
          "01000000000000000000000000000010010000100000000000",
          "00000000000000000000000000000000000000000000100000",
          "00000000000000000000000000000000000000000000000000",
          "00000000001000000000000000000000000000000000000000",
          "00000000000001000000000000000000000000000000000000",
          "00000000000000000000000000000000000000000000000100",
          "00000000010000000100000010000000000010000000000000",
          "00100000000000000000000000000000100000000000000000",
          "00000000000000000010000000000001000000000000000000",
          "00000000000000000000000010000000000000001000000000",
          "00000000000000000000000000000000000000000000010010",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000000000000000000010000000000000000000",
          "00000000000000000000000000000000000000000000010000",
          "00000000010000000000000010000000000000000100000000",
          "00000000000000000000000000000000000000000000000100",
          "00000000000000000000000000000000010000000100000000",
          "00000000000000000000000000000000000000101000000000",
          "00000000000000000000000000000000000000000000000000",
          "00000000000000010000000000000000000000000000000000",
          "00000000000000000000000001000000000000000000000000",
          "00000000000000000000000000000000001001000000000000",
          "00000000000010000000000000000000000000000000000000",
          "00100000000000000000000000000100000000010000000000",
          "00000000000000000000000000000000001000000000000000",
          "00000000000000000000000000000000000000000000000000"
        };
    int[] gridConnections = new int[] {34, 42, 6, 18, 3, 25, 15, 36};

    int expected = 410;
    int actual = solution.maxNewWires(wires, gridConnections);

    Assert.assertEquals(expected, actual);
  }