This code doesn't work on a particular input case of [1,2] and 1.
It should return [2,1] but according to the judge, my code returns [1,2]
I verified it locally and it actually returns [1,2]. Any thoughts?
I coded it in another way to get it accepted. Still I am curious!
class Solution: # @param nums, a list of integer # @param k, num of steps # @return nothing, please modify the nums list in-place. def rotate(self, nums, k): nums = nums[-k:] + nums[:-k]