TypeScript one line solution.
typescript\nfunction rotate(nums: number[], k: number): void {\n  nums.unshift(...nums.splice(-(k % nums.length)));\n};\n\nPlease upvote if you found the soluti
```typescript\nfunction rotate(nums: number[], k: number): void {\n  nums.unshift(...nums.splice(-(k % nums.length)));\n};\n```\nPlease upvote if you found the solution useful.
['TypeScript']