public void TestMethod1() { //Arrange int n = 4; int expected = 70600674; //Act var res = LargestProductInGrid.Solve(n); //Assert Assert.AreEqual(expected, res); }
public void LargestProductInDiagonalTest() { int[][] intMatrix = new int[2][]; intMatrix[0] = new int[] { 3, 2 }; intMatrix[1] = new int[] { 1, 4 }; int adjacentNumbers = 2; long largestProduct = 12; long calcProduct = LargestProductInGrid.CalculateLargestProduct(intMatrix, adjacentNumbers); Assert.AreEqual(largestProduct, calcProduct); }
public void LargestProductInDiagonalTestTwo() { int[][] intMatrix = new int[3][]; intMatrix[0] = new int[] { 1, 10, 2 }; intMatrix[1] = new int[] { 1, 2, 3 }; intMatrix[2] = new int[] { 0, 2, 0 }; long largestProduct = 30; int adjacentNumbers = 2; long calculatedProduct = LargestProductInGrid.CalculateLargestProduct(intMatrix, adjacentNumbers); Assert.AreEqual(largestProduct, calculatedProduct); }
public void LargestProductInColumnRowTestTwo() { int[][] intMatrix = new int[3][]; intMatrix[0] = new int[] { 1, 2, 3 }; intMatrix[1] = new int[] { 1, 0, 6 }; intMatrix[2] = new int[] { 1, 0, 2 }; int adjacentNumbers = 2; long largestProduct = 18; long calcProduct = LargestProductInGrid.CalculateLargestProduct(intMatrix, adjacentNumbers); Assert.AreEqual(largestProduct, calcProduct); }
public void LargestProductInDiagonalTestFour() { int[][] intMatrix = new int[5][]; intMatrix[0] = new int[] { 12, 50, 10, 2, 69 }; intMatrix[1] = new int[] { 10, 51, 23, 59, 1 }; intMatrix[2] = new int[] { 10, 1, 5, 50, 8 }; intMatrix[3] = new int[] { 2, 56, 23, 23, 56 }; intMatrix[4] = new int[] { 12, 4, 456, 23, 256 }; int adjacentNumbers = 3; long largestProduct = 456 * 23 * 256; long calculatedProduct = LargestProductInGrid.CalculateLargestProduct(intMatrix, adjacentNumbers); Assert.AreEqual(largestProduct, calculatedProduct); }