Infosys interview question

reverse linked list in k groups