โจทย์
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!".
เงื่อนไข
0 ≤ start ≤ 1,000
ตัวอย่าง
ตัวอย่างที่ 1
อินพุต:
start = 3
ผลลัพธ์ที่คาดหวัง:
expected = ["3", "2", "1", "Liftoff!"]
อินพุต:
long long start = 3;
ผลลัพธ์ที่คาดหวัง:
std::vector<std::string> expected = {"3", "2", "1", "Liftoff!"};
อินพุต:
long start = 3;
ผลลัพธ์ที่คาดหวัง:
string[] expected = new string[] {"3", "2", "1", "Liftoff!"};
คำอธิบาย
"3", "2", "1", then "Liftoff!".
ตัวอย่างที่ 2
อินพุต:
start = 0
ผลลัพธ์ที่คาดหวัง:
expected = ["Liftoff!"]
อินพุต:
long long start = 0;
ผลลัพธ์ที่คาดหวัง:
std::vector<std::string> expected = {"Liftoff!"};
อินพุต:
long start = 0;
ผลลัพธ์ที่คาดหวัง:
string[] expected = new string[] {"Liftoff!"};
คำอธิบาย
There is nothing to count, so only "Liftoff!" remains.
แหล่งอ้างอิง
โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน