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.
Incase of 3 -> 2 -> 1 ->null where head is 3, head.next.next=head will point the node 2 to node 3 instead of 1 i.e.,
3<=>2 X 1->null(X representing no relation and <=> representing a relation where 3.next will give 2 and vice versa)
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 →
Incase of 3 -> 2 -> 1 ->null where head is 3, head.next.next=head will point the node 2 to node 3 instead of 1 i.e., 3<=>2 X 1->null(X representing no relation and <=> representing a relation where 3.next will give 2 and vice versa)