#16Playlist Remix
A DJ has a playlist containing n songs arranged in a specific order. Each song is represented by an integer.
To create a remix, the DJ shifts the entire playlist k positions to the left. The playlist is cyclic, so the songs shifted out from the beginning are moved to the end. Determine how the playlist looks after the remix.
Real-World Applications: Cyclic Task Scheduling; Data Stream Rotation; Round-Robin Resource Allocation;
Examples
Example 1
Input: n = 5, k = 2
playlist = [1, 5, 3, 4, 2]
Output: [3, 4, 2, 1, 5]
Explanation:
[1, 5, 3, 4, 2] Shift left by 2 [3, 4, 2, 1, 5]
Example 2
Input: n = 6, k = 5
playlist = [10, 1, 2, 9, 8, 2]
Output: [2, 10, 1, 2, 9, 8]
Explanation:
After shifting the playlist 5 positions to the left, the first five songs move to the end.
Constraints
- 1 ≤ T ≤ 100
- 1 ≤ n ≤ 10⁵
- Sum of n over all test cases ≤ 3 × 10⁵
- 0 ≤ k ≤ n
- −10⁹ ≤ playlist[i] ≤ 10⁹