Exemple #1
0
        public void MaxPathSumTest_6()
        {
            var input = TestHelper.GenerateTree(new int?[] { -10, 9, 20, null, null, 15, 7 });

            var solution = new _0124_BinaryTreeMaximumPathSum();
            var result   = solution.MaxPathSum(input);

            Assert.AreEqual(42, result);
        }
Exemple #2
0
        public void MaxPathSumTest_9()
        {
            var input = TestHelper.GenerateTree(new int?[] { 0, 1, 1 });

            var solution = new _0124_BinaryTreeMaximumPathSum();
            var result   = solution.MaxPathSum(input);

            Assert.AreEqual(2, result);
        }
Exemple #3
0
        public void MaxPathSumTest_10()
        {
            var input = TestHelper.GenerateTree(new int?[] { 1, -2, -3, 1, 3, -2, null, -1 });

            var solution = new _0124_BinaryTreeMaximumPathSum();
            var result   = solution.MaxPathSum(input);

            Assert.AreEqual(3, result);
        }