Problème
Afficher la traductionCount down from start to 1, then add "Liftoff!". Each number becomes one text entry.
Implement countdown(start).
Input
start: The number to start counting down from.
Output
Return the countdown as a list of strings, ending with "Liftoff!".
Contraintes
0 ≤ start ≤ 1,000
Exemples
Exemple 1
Entrée :
start = 3
Sortie attendue :
expected = ["3", "2", "1", "Liftoff!"]
Entrée :
long long start = 3;
Sortie attendue :
std::vector<std::string> expected = {"3", "2", "1", "Liftoff!"};
Entrée :
long start = 3;
Sortie attendue :
string[] expected = new string[] {"3", "2", "1", "Liftoff!"};
Explication
"3", "2", "1", then "Liftoff!".
Exemple 2
Entrée :
start = 0
Sortie attendue :
expected = ["Liftoff!"]
Entrée :
long long start = 0;
Sortie attendue :
std::vector<std::string> expected = {"Liftoff!"};
Entrée :
long start = 0;
Sortie attendue :
string[] expected = new string[] {"Liftoff!"};
Explication
There is nothing to count, so only "Liftoff!" remains.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.