use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _501Test method test1.
@Test
public void test1() {
treeNode = new TreeNode(1);
treeNode.right = new TreeNode(2);
treeNode.right.left = new TreeNode(2);
expected = new int[] { 2 };
CommonUtils.printArray(expected);
CommonUtils.printArray(actual);
actual = solution1.findMode(treeNode);
assertArrayEquals(expected, actual);
actual = solution2.findMode(treeNode);
assertArrayEquals(expected, actual);
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _515Test method test1.
@Test
public void test1() {
TreeNode root = new TreeNode(1);
root.left = new TreeNode(3);
root.right = new TreeNode(2);
expected = Arrays.asList(1, 3);
actual = solution1.largestValues(root);
assertEquals(expected, actual);
actual = solution2.largestValues(root);
assertEquals(expected, actual);
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _538Test method test1.
@Test
public void test1() {
root = new TreeNode(5);
root.left = new TreeNode(2);
root.right = new TreeNode(13);
expectedRoot = new TreeNode(18);
expectedRoot.left = new TreeNode(20);
expectedRoot.right = new TreeNode(13);
assertEquals(expectedRoot.toString(), genericSolution.convertBST(root).toString());
assertEquals(expectedRoot.toString(), bstSolution.convertBST(root).toString());
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _563Test method test1.
@Test
public void test1() {
root = new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
expected = 1;
actual = test.findTilt(root);
assertEquals(expected, actual);
}
use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.
the class _572Test method test1.
@Test
public void test1() {
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);
s.left.right.left = new TreeNode(0);
TreeNode t = new TreeNode(4);
t.left = new TreeNode(1);
t.right = new TreeNode(2);
expected = false;
actual = solution1.isSubtree(s, t);
assertEquals(expected, actual);
}
Aggregations