You are viewing a single comment's thread. Return to all comments →
function compareLinkedLists( headA, headB) { // 1 Size // 2 Values for (let currentA = headA, currentB = headB; currentA; currentA = currentA.next, currentB = currentB.next) { if (!currentB || !currentA.next && currentB.next) { return 0 } if (currentA.data !== currentB.data) { return 0 } } return 1 }
Seems like cookies are disabled on this browser, please enable them to open this website
Compare two linked lists
You are viewing a single comment's thread. Return to all comments →