You are viewing a single comment's thread. Return to all comments →
python3
def mergeLists(head1, head2): temp=[] cur=head1 while cur: temp.append(cur.data) cur=cur.next cur=head2 while cur: temp.append(cur.data) cur=cur.next temp.sort() llist=SinglyLinkedList() for i in temp: llist.insert_node(i) return llist.head
greate jugaad !!! smart work !!!
If we can use array then what is the point of solving LL problems?
Haha, I was also tempted to convert it to a list, but then told my self the exact same thing.
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
python3
greate jugaad !!! smart work !!!
If we can use array then what is the point of solving LL problems?
Haha, I was also tempted to convert it to a list, but then told my self the exact same thing.