10 XP challenge
Move the First Item to the End
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return numbers rotated one place left. For [4, 7, 9], return [7, 9, 4]. Empty input remains empty. numbers contains 0 to 30 integers from -100 to 100.
Examples
| Input | Return |
|---|---|
numbers = [4,7,9]answer: [] → [7] → [7,9] → [7,9,4]. The result is [7,9,4]. | [7,9,4] |
numbers = [1,2,3,4]answer: [] → [2] → [2,3] → [2,3,4] → [2,3,4,1]. The result is [2,3,4,1]. | [2,3,4,1] |
Your code
Write your answer inside Solution, then use return to send it back.
Ln 1, Col 1
JavaScript
Try examples runs the public examples. Check my code checks your full answer and saves your completion.