Esempio n. 1
0
        public void CurrentSum()
        {
            TreeNode n = new TreeNode(5)
            {
                Left = new TreeNode(-3)
                {
                    Left = new TreeNode(5)
                    {
                        Left = new TreeNode(-3)
                    }
                },
                Right = new TreeNode(8)
                {
                    Left = new TreeNode(-2)
                    {
                        Left = new TreeNode(-9)
                    },
                    Right = new TreeNode(-11)
                }
            };

            var result = TreesAndGraphs.PathSum(n, 2);

            Assert.AreEqual(5, result);
        }