struct ListNode* rotateRight(struct ListNode* head, int k){ if(!head) return NULL; struct ListNode* arr[1000]; int cnt=0, i, n; while(head){ arr[cnt++]=head; head=head->next; } if(k%cnt == 0 || cnt==1) return arr[0]; arr[cnt-1]->next=arr[0]; arr[cnt-k%cnt-1]->next=NULL; return arr[cnt-k%cnt]; }