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.
Really great of you to write it out like this so the logic is easily understandable. For those who need an explanation, the difference between @anil_pai version and @CHarmon is basically the former is performing a simultaneous update on the 4th line. This allows multiple variables to be updated before commiting to memory. @CHarmon does this sequentially, however, this requires original copies to be made so they can be referenced again when updating the following variables.
I really like that both versions were included. This is why I love this site and community.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →
Really great of you to write it out like this so the logic is easily understandable. For those who need an explanation, the difference between @anil_pai version and @CHarmon is basically the former is performing a simultaneous update on the 4th line. This allows multiple variables to be updated before commiting to memory. @CHarmon does this sequentially, however, this requires original copies to be made so they can be referenced again when updating the following variables.
I really like that both versions were included. This is why I love this site and community.