Infosys interview question

reverse the link list garbage collector