Dsa
Arrays
Warm-up
Rotate Array
Write a function that takes an array and integer 'k', and rotates the array to the right by 'k' steps. Example input: '[1, 2, 3, 4, 5]
2' --> Output: '[4, 5, 1, 2, 3]'
Key concepts
arraysrotationmodulo
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now