def rotateRight(self, head, k):
        """
        :type head: ListNode
        :type k: int
        :rtype: ListNode
        """
        if not head or not head.next:
            return head

        n, cur = 1, head
        while cur.next:
            cur = cur.next
            n += 1
        cur.next = head

        cur, tail = head, cur
        for _ in xrange(n - n % k):
            tail = cur
            cur = cur.next
        tail.next = None

        return cur
dataset/ETHPy150Open kamyu104/LeetCode/Python/rotate-list.py/Solution.rotateRight/swapped operands of `%`