how to solve reverse a linked list