```
class Solution:
def reverseKGroup(self, head, k):
length = 0
current = head
while current:
length += 1
current = current.next
if k>length: return head
current = head
prev = None
count = 1
while count <= k:
nextCurrent = current.next
if prev: current.next = prev
prev = current
current = nextCurrent
count += 1
head.next = self.reverseKGroup(current, k)
return prev
```