Example #1
0
 def test_case_2(self):
     test = BinaryTree(1).insert([2, -1])
     self.assertEqual(maxPathSum(test), 3)
Example #2
0
 def test_case_13(self):
     test = BinaryTree(1).insert([
         -5, -3, 0, 2, 2, 1, -3, 3, 1, 1, 0, 5, 1, 1, 0, 1, 1, -1, -1, -6,
         -1, -100, -9, -91, 2, 1, 0, 1, 5, 0
     ])
     self.assertEqual(maxPathSum(test), 13)
Example #3
0
 def test_case_9(self):
     test = BinaryTree(1).insert([
         -150, -5, 30, 75, -20, -21, 5, 1, 3, -3, 100, 2, 100, 1, 100, 100,
         5, 10, 150, 151
     ])
     self.assertEqual(maxPathSum(test), 304)
Example #4
0
 def test_case_6(self):
     test = BinaryTree(1).insert(
         [-10, -5, 30, 45, -20, -21, 5, 1, 3, -3, 100, 2, 100, 1, 100])
     self.assertEqual(maxPathSum(test), 201)
Example #5
0
 def test_case_4(self):
     test = BinaryTree(1).insert([2, 3, 4, 5, 6, 7])
     self.assertEqual(maxPathSum(test), 18)
Example #6
0
 def test_case_3(self):
     test = BinaryTree(1).insert([-5, 3, 6])
     self.assertEqual(maxPathSum(test), 6)