We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Merge two sorted linked lists
Merge two sorted linked lists
Sort by
recency
|
981 Discussions
|
Please Login in order to post a comment
My Java solution with linear time complexity and constant space complexity:
def mergeLists(head1, head2):
def mergeLists(head1, head2): dummy=SinglyLinkedListNode(0) cur=dummy while head1 and head2:
function mergeLists(head1, head2) { let newNode = new SinglyLinkedListNode(); let tail = newNode;
}