def reverseWithK(self, head, k):
    current = head
    next = None
    temp = None
    count = 0
    while ((current is not None) and (count < k)):
        next = current.next
        current.next = temp
        temp = current
        current = next
        count += 1
    if (next is not None):
        head.next = self.reverseWithK(next, k)
    return temp
def reverseWithK(self, head, k):
    current = head
    next = None
    temp = None
    count = 0
    while ((current is not None) and (count < k)):
        next = current.next
        current.next = temp
        temp = current
        current = next
        count += 1
    if (next is not None):
        head.next = self.reverseWithK(next, k)
    return temp