public void FindsALowerCommonAncestor() { var inputOne = TreeNode.BuildTreeOne(); var hasSumOne = PathSum.HasPath(inputOne, 9); Assert.True(hasSumOne); var inputTwo = TreeNode.BuildTreeThree(); var hasSumTwo = PathSum.HasPath(inputTwo, 4); Assert.True(hasSumTwo); }
public void ReturnsLowestCommonAncestorForInheritedNodes() { var inputOne = TreeNode.BuildTreeOne(); var hasSumOne = PathSum.HasPath(inputOne, 8); Assert.False(hasSumOne); var inputTwo = TreeNode.BuildTreeThree(); var hasSumTwo = PathSum.HasPath(inputTwo, 18); Assert.False(hasSumTwo); }