public void HackerRankSampleBTest() { int[][] m = GetInputMatrixFromFile(_sTestDataRootDir + "sample2_input.txt"); int expectedResult = 5; int result = ConnectedCellsInAGrid.connectedCell(m); Assert.AreEqual(result, expectedResult); }
public void Rectangle2MultipleRegionsTest() { int[][] m = GetInputMatrixFromFile(_sTestDataRootDir + "rectangle_size2_input.txt"); //ConnectedCellsInAGrid.InitMatrix(m); //ConnectedCellsInAGrid.ColorMatrixRegions(); //ConnectedCellsInAGrid.PrintMatrix(); //int result = ConnectedCellsInAGrid.GetMaxColoredRegionSize(); int result = ConnectedCellsInAGrid.connectedCell(m); int expectedResult = 6; Assert.AreEqual(result, expectedResult); }
public void Circle1Test() { int[][] m = GetInputMatrixFromFile(_sTestDataRootDir + "circle1_input.txt"); //ConnectedCellsInAGrid.InitMatrix(m); //ConnectedCellsInAGrid.ColorMatrixRegions(); //ConnectedCellsInAGrid.PrintMatrix(); //int result = ConnectedCellsInAGrid.GetMaxColoredRegionSize(); int result = ConnectedCellsInAGrid.connectedCell(m); int expectedResult = 10; Assert.AreEqual(result, expectedResult); }
public void MainFlow(string inputString) { var algor = new ConnectedCellsInAGrid(); var input = new StringReader(inputString); int n = Convert.ToInt32(input.ReadLine()); int m = Convert.ToInt32(input.ReadLine()); int[][] matrix = new int[n][]; for (int i = 0; i < n; i++) { matrix[i] = Array.ConvertAll(input.ReadLine().Split(' '), matrixTemp => Convert.ToInt32(matrixTemp)); } int result = algor.connectedCell(matrix); }