Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }