Ejemplo n.º 1
0
 def test_should_get_the_greatest_product_of_3_numbers_in_a_3x3_matrix(self):
     matrix = Matrix([[2, 1, 5], [1, 9, 4], [5, 8, 3]])
     """
     [
     [2, 1, 5],
     [1, 9, 4],
     [5, 8, 3]
     ]
     """
     result = matrix.greatest_diagonal_product(3)
     self.assertEqual(result, 225)
Ejemplo n.º 2
0
 def test_should_get_the_greatest_product_of_3_numbers_in_a_6x6_matrix(self):
     matrix = Matrix([[2, 1, 5, 8, 2, 7], [1, 9, 4, 1, 3, 2], [5, 2, 3, 9, 2, 4], [9, 1, 2, 10, 13, 9], [9, 82, 1, 23, 5, 8], [9, 12, 48, 1, 2, 8]])
     """
     [
     [02, 01, 05, 08, 02, 07],
     [01, 09, 04, 01, 03, 02],
     [05, 02, 03, 09, 02, 04],
     [09, 01, 02, 83, 13, 09],
     [09, 82, 01, 23, 55, 08],
     [09, 12, 48, 01, 02, 98]
     ]
     """
     # 447370
     self.assertEqual(matrix.greatest_diagonal_product(3), 447370)
Ejemplo n.º 3
0
 def test_should_get_the_product_of_2_numbers_in_a_1x3_matrix(self):
     matrix = Matrix([[2, 3, 5]])
     assert_equals(matrix.greatest_line_product(2), 15)
Ejemplo n.º 4
0
 def test_should_get_the_greatest_product_of_6_numbers_in_a_6x6_matrix(self):
     matrix = Matrix([[2, 1, 5, 8, 2, 7], [1, 9, 4, 1, 3, 2], [5, 2, 3, 9, 2, 4], [9, 1, 2, 10, 13, 9], [9, 82, 1, 23, 5, 8], [9, 12, 48, 1, 2, 8]])
     self.assertEqual(matrix.greatest_column_product(6), 32256)
Ejemplo n.º 5
0
 def test_should_get_the_greatest_product_of_2_numbers_in_a_3x3_matrix(self):
     matrix = Matrix([[2, 1, 5], [1, 9, 4], [5, 2, 3]])
     self.assertEqual(matrix.greatest_column_product(2), 20)
Ejemplo n.º 6
0
 def test_should_get_the_greatest_product_of_3_numbers_in_a_3x3_matrix(self):
     matrix = Matrix([[2, 1, 5], [1, 9, 4], [5, 2, 3]])
     self.assertEqual(matrix.greatest_line_product(3), 36)
Ejemplo n.º 7
0
 def test_should_get_the_product_of_4_numbers_in_a_2x5_matrix(self):
     matrix = Matrix([[2, 1, 5, 3, 2], [1, 9, 4, 3, 5]])
     assert_equals(matrix.greatest_line_product(4), 540)
Ejemplo n.º 8
0
 def test_should_get_the_product_of_3_numbers_in_a_2x3_matrix(self):
     matrix = Matrix([[2, 1, 5], [4, 3, 5]])
     assert_equals(matrix.greatest_line_product(3), 60)
Ejemplo n.º 9
0
 def test_should_get_the_product_of_2_numbers_in_a_1x5_matrix(self):
     matrix = Matrix([[4, 2, 8, 5, 1]])
     assert_equals(matrix.greatest_line_product(2), 40)