Python easy to understand solutions.
    \n    def rotate1(self, nums, k):\n        k %= len(nums)\n        self.reverse(nums, 0, len(nums)-1)\n        self.reverse(nums, 0, k-1)\n        self.reve
        \n    def rotate1(self, nums, k):\n        k %= len(nums)\n        self.reverse(nums, 0, len(nums)-1)\n        self.reverse(nums, 0, k-1)\n        self.reverse(nums, k, len(nums)-1)\n        \n    def reverse(self, nums, l, r):\n        while l < r:\n            nums[l], nums[r] = nums[r], nums[l]\n            l += 1\n            r -= 1\n            \n    def rotate2(self, nums, k):\n        k %= len(nums)\n        for _ in xrange(k):\n            nums.insert(0, nums.pop())\n     \n    # O(n) space       \n    def rotate(self, nums, k):\n        deque = collections.deque(nums)\n        k %= len(nums)\n        for _ in xrange(k):\n            deque.appendleft(deque.pop())\n        nums[:] = list(deque)
['Python']