use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _572Test method test2.
@Test
public void test2() {
TreeNode s = new TreeNode(3);
s.left = new TreeNode(4);
s.right = new TreeNode(5);
s.left.left = new TreeNode(1);
s.left.right = new TreeNode(2);
TreeNode t = new TreeNode(4);
t.left = new TreeNode(1);
t.right = new TreeNode(2);
expected = true;
actual = solution1.isSubtree(s, t);
assertEquals(expected, actual);
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _652Test method test1.
@Test
public void test1() {
root = new TreeNode(1);
root.left = new TreeNode(2);
root.left.left = new TreeNode(4);
root.right = new TreeNode(3);
root.right.left = new TreeNode(2);
root.right.left.left = new TreeNode(4);
root.right.right = new TreeNode(4);
TreeNode tree1 = new TreeNode(2);
tree1.left = new TreeNode(4);
TreeNode tree2 = new TreeNode(4);
expected = new ArrayList<>(Arrays.asList(tree2, tree1));
assertEquals(expected, test.findDuplicateSubtrees(root));
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _652Test method test3.
@Test
public void test3() {
root = new TreeNode(2);
root.left = new TreeNode(1);
root.right = new TreeNode(1);
TreeNode tree1 = new TreeNode(1);
expected = new ArrayList<>(Arrays.asList(tree1));
assertEquals(expected, test.findDuplicateSubtrees(root));
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _653Test method test3.
@Test
public void test3() {
root = new TreeNode(1);
expected = false;
assertEquals(expected, listSolution.findTarget(root, 2));
assertEquals(expected, mapSolution.findTarget(root, 2));
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _98Test method test3.
@Test
public void test3() {
root = new TreeNode(1);
root.left = new TreeNode(1);
assertEquals(false, solution1.isValidBST(root));
}
Aggregations