The trick is if we never jump to the start position, we can traverse the whole array. If we jump to the start position, the num in position start+1 must not be visited!

```
void rotate(vector<int>& nums, int k) {
if (nums.empty() || k == 0) return;
int len = nums.size(), moved = 0, i = 0, t = nums[0], starti = 0;
while (++moved <= len) {
i = (i+k) % len;
swap(t,nums[i]);
if (i == starti) {
i = ++starti;
t = nums[i];
}
}
}
```