DOCUMENTATION
Question link :https://practice.geeksforgeeks.org/problems/rotate-a-linked-list/1
Given a singly linked list of size N. The task is to rotate the linked list counter-clockwise by k nodes, where k is a given positive integer smaller than or equal to length of the linked list.
Example 1:
Input:
N = 8
value[] = {1,2,3,4,5,6,7,8}
k = 4
Output: 5 6 7 8 1 2 3 4
Asked in : Amazon, MakeMyTrip
Optimised Approach -  Traverse the linked list till the kth node and make the kth node's next as NULL.And point the head node to the (k+1) node and link the last node to the first node.
Time and Space Complexity : 
Time - O(n)
Space - O(n)
Pseudocode  : if(head==NULL) 
    return head;
    Node* p = NULL;
    Node* temp = head;
    while(k!=0 & temp!=NULL)
    {
        k--;
        p=temp;
        temp=temp->next;
  }
  if(temp == NULL) 
    return head; 
   Node* q = temp; 
    p->next = NULL; 
 while(temp->next)
        temp = temp->next;
 temp->next = head;
 return q;
