Rotate List
class Solution {
public:
ListNode *rotateRight(ListNode *head, int k)
{
if(head==NULL)return NULL;
ListNode *p=head;
int n=0;
while(p->next)
{
p=p->next;
n++;
}
n++;
k=k%n;
p->next=head;
ListNode *q=head;
for(int i=0;i<n-k-1;i++)
q=q->next;
head=q->next;
q->next=NULL;
return head;
}
};