• + 2 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
    
    • + 0 comments

      greate jugaad !!! smart work !!!

    • + 1 comment

      If we can use array then what is the point of solving LL problems?

      • + 0 comments

        Haha, I was also tempted to convert it to a list, but then told my self the exact same thing.