Linked List K reverse

The code i wrote returns the reversed form of linked list of what was asked in the output,i am not able to understand why so,please help!

u have to reverse only k part at a time
like if LL 1 2 3 4 5 6 and k=2 then u have to reverse the for the consecutive 2 elements
like ans of above is 2 1 4 3 6 5 here for each consecutive 2 element the LL is reversed
if k=3 then ans = 3 2 1 6 5 4 here for each 3 consecutive element the LL got reversed
Hope thia help:)

Hey Ratik,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.