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.
Hey could you explain why this works? because I put a print statement right at the end of the loop after "temp = temp.prev" and it gave me a nullpointer exception. However, when i put that print statement at the start of loop, there was no error; could you give some sort of explanation of this algorithm? thanks.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a doubly linked list
You are viewing a single comment's thread. Return to all comments →
Hey could you explain why this works? because I put a print statement right at the end of the loop after "temp = temp.prev" and it gave me a nullpointer exception. However, when i put that print statement at the start of loop, there was no error; could you give some sort of explanation of this algorithm? thanks.