Fácil 0 resolvidos 0% de aceitação

Fizz Buzz

Build a sequence using divisibility by 3 and 5.

For each integer from 1 through limit, use Fizz for multiples of 3, Buzz for multiples of 5, and FizzBuzz for multiples of both. Otherwise use the number written as text. Return the entries in order instead of printing them.

Implement fizz_buzz(limit).

Input

limit: The last integer to include.

Output

Return a list of strings, one for each integer from 1 through limit.

Restrições

0 ≤ limit ≤ 10,000. A limit of 0 produces an empty list.

Exemplos

Exemplo 1
Entrada:
limit = 5

Saída esperada:
expected = ["1", "2", "Fizz", "4", "Buzz"]
Entrada:
long long limit = 5;

Saída esperada:
std::vector<std::string> expected = {"1", "2", "Fizz", "4", "Buzz"};
Entrada:
long limit = 5;

Saída esperada:
string[] expected = new string[] {"1", "2", "Fizz", "4", "Buzz"};

Explicação

3 is divisible by 3 and 5 is divisible by 5. Other entries keep their number.

Exemplo 2
Entrada:
limit = 0

Saída esperada:
expected = []
Entrada:
long long limit = 0;

Saída esperada:
std::vector<std::string> expected = {};
Entrada:
long limit = 0;

Saída esperada:
string[] expected = new string[] {};

Explicação

There are no integers from 1 through 0, so the list is empty.

Referências

Este desafio foi adaptado para o CodeUtility. Siga o enunciado e as restrições acima.

Aprenda com outros

Soluções da comunidade

Ainda não há soluções publicadas. Resolva este desafio para compartilhar a primeira.