Oracle interview question

reverse a linked list when head is given as input.