示例#1
0
        public void PathSum_SingleNodeTree()
        {
            var treeArr = new int?[] { 1 };
            var tree    = TreeNode.CreateTree(treeArr);
            var result  = PathSumImplementation.PathSum(tree, 1);

            result.Should().Be(1);
        }
示例#2
0
        public void PathSum_FromLeetCode()
        {
            var treeArr = new int?[] { 10, 5, -3, 3, 2, null, 11, 3, -2, null, 1 };
            var tree    = TreeNode.CreateTree(treeArr);
            var result  = PathSumImplementation.PathSum(tree, 8);

            result.Should().Be(3);
        }