5 XP challenge
Make an Alternating Banner
very easy
Build it yourself · 3 min
1 Learn2 Predict3 Solve
TaskYour mission
Return pieces fragments alternating first, second, first, second, starting with first. Each fragment has 0 to 4 ASCII letters; pieces is 0 to 8.
Examples
| Input | Return |
|---|---|
first = "a", second = "b", pieces = 5answer: "" → "a" → "ab" → "aba" → "abab" → "ababa". The result is "ababa". | "ababa" |
first = "ab", second = "X", pieces = 4answer: "" → "ab" → "abX" → "abXab" → "abXabX". The result is "abXabX". | "abXabX" |
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.