Code for problem "Reverse Nodes in k-Group".