this code is showing tle.please help.
K reverse code problem
u are taking input K in buildList function but then u are not using it
the K factor has to be used to create groups of k and then reverse them
do something like

also in print function cout << temp->data <<" ";
and not temp->next
It shows a warning and then does not compile.

check out this code