Problem
Count 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!".
Einschränkungen
0 ≤ start ≤ 1,000
Beispiele
Eingabe:
start = 3
Erwartete Ausgabe:
expected = ["3", "2", "1", "Liftoff!"]
Eingabe:
long long start = 3;
Erwartete Ausgabe:
std::vector<std::string> expected = {"3", "2", "1", "Liftoff!"};
Eingabe:
long start = 3;
Erwartete Ausgabe:
string[] expected = new string[] {"3", "2", "1", "Liftoff!"};
Erläuterung
"3", "2", "1", then "Liftoff!".
Eingabe:
start = 0
Erwartete Ausgabe:
expected = ["Liftoff!"]
Eingabe:
long long start = 0;
Erwartete Ausgabe:
std::vector<std::string> expected = {"Liftoff!"};
Eingabe:
long start = 0;
Erwartete Ausgabe:
string[] expected = new string[] {"Liftoff!"};
Erläuterung
There is nothing to count, so only "Liftoff!" remains.
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.