Tripadvisor interview question

Reverse a linked list

Interview Answer

Anonymous

10 Jan 2013

You could either first iterate over the linked list removing the items and putting them in stack, then iterate over the stack popping off the top element and inserting it back into the linked list. You could also use recursion, but its less obvious.