def rotate(self, nums, k):
k %= len(nums)
for i in range(k):
Insert in the beginning is o(n), so this solution is not very efficient.
That's true. I just wanted to make the code simple and easily understandable~
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.