use of com.fishercoder.common.classes.ListNode in project Leetcode by fishercoder1534.
the class _328Test method test1.
@Test
public void test1() {
node = new ListNode(1);
node.next = new ListNode(2);
node.next.next = new ListNode(3);
node.next.next.next = new ListNode(4);
node.next.next.next.next = new ListNode(5);
expected = new ListNode(1);
expected.next = new ListNode(3);
expected.next.next = new ListNode(5);
expected.next.next.next = new ListNode(2);
expected.next.next.next.next = new ListNode(4);
assertEquals(expected, test.oddEvenList(node));
}
use of com.fishercoder.common.classes.ListNode in project Leetcode by fishercoder1534.
the class _445Test method test1.
@Test
public void test1() {
ListNode l1 = LinkedListUtils.contructLinkedList(new int[] { 7, 2, 4, 3 });
ListNode l2 = LinkedListUtils.contructLinkedList(new int[] { 5, 6, 4 });
ListNode expected = LinkedListUtils.contructLinkedList(new int[] { 7, 8, 0, 7 });
assertEquals(expected, test.addTwoNumbers(l1, l2));
}
use of com.fishercoder.common.classes.ListNode in project Leetcode by fishercoder1534.
the class _445Test method test2.
@Test
public void test2() {
ListNode l1 = LinkedListUtils.contructLinkedList(new int[] { 7, 2, 4, 3 });
ListNode l2 = LinkedListUtils.contructLinkedList(new int[] { 5, 6, 4 });
ListNode expected = LinkedListUtils.contructLinkedList(new int[] { 7, 8, 0, 7 });
assertEquals(expected, solution2.addTwoNumbers(l1, l2));
}
use of com.fishercoder.common.classes.ListNode in project Leetcode by fishercoder1534.
the class _445Test method test3.
@Test
public void test3() {
ListNode l1 = LinkedListUtils.contructLinkedList(new int[] { 5 });
ListNode l2 = LinkedListUtils.contructLinkedList(new int[] { 5 });
ListNode expected = LinkedListUtils.contructLinkedList(new int[] { 1, 0 });
assertEquals(expected, solution2.addTwoNumbers(l1, l2));
}
use of com.fishercoder.common.classes.ListNode in project Leetcode by fishercoder1534.
the class _725Test method test3.
@Test
public void test3() {
root = LinkedListUtils.contructLinkedList(new int[] { 1, 2, 3 });
k = 5;
actual = solution2.splitListToParts(root, k);
for (ListNode head : actual) {
ListNode.printList(head);
}
}
Aggregations