Amazon interview question

Question was a reversed linked list problem