educative.io

Educative

Implementation incorrect

Using this test data, the output is “1,1,2” which is incorrect. I expect “1,2”.

llist_1 = LinkedList()
llist_2 = LinkedList()

llist_1.append(1)
llist_1.append(2)
llist_2.append(1)

llist_1.merge_sorted(llist_2)
llist_1.print_list()

Hello @Jo1,

Basically, in this particular lesson, Merge Two Sorted Linked Lists, we only merged the two sorted linked lists. We are not handling the duplication in the merged linked list. We are simply merging the sorted linked lists so that our merged linked list should be in a sorted manner.

I hope I have answered your query; please let me know if you still have any confusion.

Thank You :blush: