Skip to main content

Practice · 4 of 5

Rotate Left

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Given n numbers and k, rotate the array left by k positions and print it. Values may wrap multiple times (k can exceed n). **Input:** Line 1: n k (1 ≤ n ≤ 10^5, 0 ≤ k ≤ 10^9). Line 2: n numbers. **Output:** The rotated array, space-separated. **Example:** 5 2 / 1 2 3 4 5 → 3 4 5 1 2.

Back to lesson: Practice: Array Mechanics Set