Given a singly linked list and an integer K, reverses the nodes of the
list K at a time and returns modified linked list.
NOTE : The length of the list is divisible by K
Given linked list
1 -> 2 -> 3 -> 4 -> 5 -> 6 and K=2,
You should return
2 -> 1 -> 4 -> 3 -> 6 -> 5
Try to solve the problem using constant extra space.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.