public void TestThirdCase() { var first = new TreeNode(1, new TreeNode(2), new TreeNode(1)); var second = new TreeNode(1, left: new TreeNode(1), right: new TreeNode(2)); var sol = new SameTree(first, second); var result = sol.IsSameTree(); Assert.False(result); }
public void TestFirstCase() { var first = new TreeNode(1, new TreeNode(2), new TreeNode(3)); var second = new TreeNode(1, new TreeNode(2), new TreeNode(3)); var sol = new SameTree(first, second); var result = sol.IsSameTree(); Assert.True(result); }
public bool IsSameTree(TreeNode p, TreeNode q) { var sameTree = new SameTree(p, q); return(sameTree.IsSameTree()); }