CT202

Rotate the Parade Line

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Move a prefix of a lineup behind the remaining people. Task: Rotate the list left by k positions; rotations wrap and k may exceed n. Input format: n, then n integers, then nonnegative k. Output format: The rotated integers, space-separated. Constraints: 1 <= n <= 100000; 0 <= k <= 10^9; -10^9 <= a[i] <= 10^9 Edge rules: Apply the stated zero, tie, boundary, and ordering conventions exactly.

Example 1:

Input: 1 5 0
Output: 5

Example 2:

Input: 1 -3 8
Output: -3

Example 3:

Input: 5 4 1 9 -2 6 2
Output: 9 -2 6 4 1

Constraints:

1 <= n <= 100000; 0 <= k <= 10^9; -10^9 <= a[i] <= 10^9

Tags:

arrays rotation
Loading...
Test Cases:No test cases
No test cases available.
Rotate the Parade Line - EASY Coding Problem | CodeTikki