def test_5(self): l1 = Node(5) l2 = Node(0) final_ll = add_two_numbers(l1, l2) self.assertEqual(traverse_list(final_ll), [5])
def test_2(self): l1 = Node(2) node2 = Node(4) node3 = Node(3) l1.next = node2 node2.next = node3 l2 = Node(5) node2 = Node(6) l2.next = node2 final_ll = add_two_numbers(l1, l2) self.assertEqual(traverse_list(final_ll), [7, 0, 4])
def test_1(self): l1 = generate_nodes([1, 2]) output = swap_pairs(l1) self.assertEqual(traverse_list(output), [2, 1])
def test_1(self): l1 = generate_nodes([1, 2, 4]) l2 = generate_nodes([1, 3, 4]) output = merge_two_lists(l1, l2) self.assertEqual(traverse_list(output), [1, 1, 2, 3, 4, 4])
def test_2(self): l1 = generate_nodes([]) l2 = generate_nodes([]) output = merge_two_lists(l1, l2) self.assertEqual(traverse_list(output), [])
def test_1(self): arr1 = generate_nodes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) out = remove_nth_frm_end(arr1, 4) self.assertEqual(traverse_list(out), [1, 2, 3, 4, 5, 6, 8, 9, 10])
def test_4(self): arr1 = generate_nodes([1, 2, 3, 4]) out = remove_nth_frm_end(arr1, 4) self.assertEqual(traverse_list(out), [2, 3, 4])