Not able to understand how to implement this

Please explain how to implenet it.
Also in the given editorial they have used head Node as a parameter but we cannot access that through client how are they supposed to call it then?

hey @bhavik911

  1. Reverse the first sub-list of size k.1.1 While reversing keep track of the next node and previous node.1.2 Let the pointer to the next node be next and pointer to the previous node be prev.
  2. head->next = reverse(next, k) //Recursively call for rest of the list and link the two sub-lists
  3. return prev // prev becomes the new head of the list (see the diagrams of iterative method of this post)

public void reverse(int k) {
this.head = reverse(this.head, k);
}
private Node reverse(Node node, int k)
{

}

Yeah I have read the editorial
Not able to understand that solution only
Here we have not assigned the head to the new head anywhere
Why not?
Also this
Also in the given editorial they have used head Node as a parameter but we cannot access that through client how are they supposed to call it then?

public void reverse(int k) {
this.head = reverse(this.head, k);
}
private Node reverse(Node node, int k)
{

}
main se reverse(int k) call hoga .
Question : Not able to understand that solution only
Take at least 1 input and dry run the above logic

Yeah i have triedd that for more than 1 input
Still not getting that we are not changing the value of head
Also I am not much comfortable with recursion using linkedlist and the solution is confusing too

@bhavik911
Try Iterative solution

Yeah done that

But i still want to understand the recursion one also

make recursive tree ya call stack

Thanks I get it now ( limit …)