IndiaMART interview question

write a code for reversing a linked list.