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.
This is so much better than the code given in editorial.
This solution does not need extra space to store the Node. (Although it does have a temp Node pointer, but node pointer is fine, storing the object Node would be big space consuming and interviewer will definitely ask to improve upon the solution given in the editorial)
Btw, you can also avoid to have that extra temp node pointer in the else condition.
Cookie support is required to access HackerRank
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 →
This is so much better than the code given in editorial.
This solution does not need extra space to store the Node. (Although it does have a temp Node pointer, but node pointer is fine, storing the object Node would be big space consuming and interviewer will definitely ask to improve upon the solution given in the editorial)
Btw, you can also avoid to have that extra temp node pointer in the else condition.