Tutte le sfide
Facile 0 risolte 0% di accettazione

Countdown to Liftoff

Count down from a number and end with Liftoff!

Problema

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!".

Vincoli

0 ≤ start ≤ 1,000

Esempi

Esempio 1
Input:
start = 3

Output atteso:
expected = ["3", "2", "1", "Liftoff!"]
Input:
long long start = 3;

Output atteso:
std::vector<std::string> expected = {"3", "2", "1", "Liftoff!"};
Input:
long start = 3;

Output atteso:
string[] expected = new string[] {"3", "2", "1", "Liftoff!"};

Spiegazione

"3", "2", "1", then "Liftoff!".

Esempio 2
Input:
start = 0

Output atteso:
expected = ["Liftoff!"]
Input:
long long start = 0;

Output atteso:
std::vector<std::string> expected = {"Liftoff!"};
Input:
long start = 0;

Output atteso:
string[] expected = new string[] {"Liftoff!"};

Spiegazione

There is nothing to count, so only "Liftoff!" remains.

Riferimenti

Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.

Impara dagli altri

Soluzioni della community

Nessuna soluzione pubblicata. Risolvi questa sfida per condividere la prima.