← all problems

launchCountdown 🌶️

A rocket launch counts down out loud. Write a method launchCountdown that takes an int n (0 or more) and returns the countdown as one String: every number from n down to 1, each followed by a space, and then Liftoff!.

For example, launchCountdown(3) is "3 2 1 Liftoff!", and launchCountdown(0) is "Liftoff!".