Qualcomm interview question

Write a function to reverse the linked list