You are viewing a single comment's thread. Return to all comments →
started with recursive then want to cry :(
function mergeLists(head1, head2) {
const elem = [] const res = (node, node2) => { let elem = node2 ? (node.data > node2.data ? node2 :node): node let nElem = node2 ? (node.data <= node2.data ? node2 :node): null return { data: elem.data, next: elem.next ? res(elem.next, nElem): nElem? res(nElem, null):null } }; return res(head1,head2)
}
Seems like cookies are disabled on this browser, please enable them to open this website
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
started with recursive then want to cry :(
function mergeLists(head1, head2) {
}