10 XP challenge
Report Every Neighboring Change
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return the difference between each item and its predecessor, in order. For [5, 8, 2], return [3, -6]. Empty and single-item inputs return an empty list. numbers contains 0 to 30 integers from -100 to 100.
Examples
| Input | Return |
|---|---|
numbers = [5,8,2]answer: [] → [3] → [3,-6]. The result is [3,-6]. | [3,-6] |
numbers = [4,4]answer: [] → [0]. The result is [0]. | [0] |
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.