Label the Cadence Slots
Intermediate SolvedA calendar view labels each slot 1..n: slots on the 3-cadence read "Fizz", on the 5-cadence "Buzz", on both "FizzBuzz", and everything else shows its number as text.
Implement `solve(Integer n)` to return a List<String> for 1..n where multiples of 3 are "Fizz", multiples of 5 are "Buzz", multiples of both are "FizzBuzz", and all others are the number as a string.
Examples
Input
n = 5Output
["1", "2", "Fizz", "4", "Buzz"]Input
n = 3Output
["1", "2", "Fizz"]Hints
- Check divisibility by 15 first (both), then 3, then 5, else String.valueOf(i).
Tests
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.