Amazon interview question

reversing a linked list from leetcode