Linked list k reverse

Kindly explain me this code as i cant understand whats happening.
Node reverse(Node head, int k)
{

   Node current = head; 
   Node next = null; 
   Node prev = null; 

   int count = 0; 

   /* Reverse first k nodes of linked list */
   while (count < k && current != null)  
   { 
       next = current.next; 
       current.next = prev; 
       prev = current; 
       current = next; 
       count++; 
   } 

   /* next is now a pointer to (k+1)th node  
      Recursively call for the list starting from current. 
      And make rest of the list as next of first node */
   if (next != null)  
      head.next = reverse(next, k); 

   // prev is now head of input list 
   return prev; 

}

hello @mkidwai74
it is simple

this loop is reversing first k nodes of the list.
and then

we are checking whether some more nodes are left or not.
if it is ,then again we are calling the same function on remaining list .
and assinging its return value to the tail of current list.

pls refer ur course linkedlist playlist, it is already covered

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.