BudiBadu Logo
00:00

Windborne Lantern Parade

Recursion Easy 0 views

When the autumn winds return, the communities of Skybridge Anchorage launch the Windborne Lantern Parade. The parade begins with a single lantern glider floating over the suspension bridges. Before more gliders launch, the steward announces how many gust tiers will join the flight. Each tier introduces a new lantern to mark the leading edge, and the wind currents send the earlier tier's lanterns circling back twice, weaving twin trails of light that help traders navigate the ravine.

The tradition keeps caravans in sync with the mountain weather. Once the guiding glider leaves the platform, every lantern from the previous tier splits into mirrored paths, returning in unison like faithful escorts. No pilot deviates from the pattern; a steady rhythm of one new lantern plus two echoes from the past keeps the air lanes clear even in swirling drafts.

Your goal is to compute how many lanterns observers see once the final tier completes its loop. The input, tiers, is a non-negative integer. When tiers equals zero, only the opening lantern appears. For each higher tier, add a guiding lantern and double the entire fleet from the previous tier. Return an integer representing the total lanterns in flight when the parade ends.

Example 1:

Input: tiers = 0
Output: 1
Explanation: Only the first lantern glider is airborne.

Example 2:

Input: tiers = 3
Output: 15
Explanation: The third tier adds a lantern and repeats the earlier tiers twice.

Example 3:

Input: tiers = 5
Output: 63
Explanation: Five tiers follow the ritual, filling the sky with sixty-three lanterns.

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.

BudiBadu Logo

Windborne Lantern Parade

Recursion Easy 0 views

When the autumn winds return, the communities of Skybridge Anchorage launch the Windborne Lantern Parade. The parade begins with a single lantern glider floating over the suspension bridges. Before more gliders launch, the steward announces how many gust tiers will join the flight. Each tier introduces a new lantern to mark the leading edge, and the wind currents send the earlier tier's lanterns circling back twice, weaving twin trails of light that help traders navigate the ravine.

The tradition keeps caravans in sync with the mountain weather. Once the guiding glider leaves the platform, every lantern from the previous tier splits into mirrored paths, returning in unison like faithful escorts. No pilot deviates from the pattern; a steady rhythm of one new lantern plus two echoes from the past keeps the air lanes clear even in swirling drafts.

Your goal is to compute how many lanterns observers see once the final tier completes its loop. The input, tiers, is a non-negative integer. When tiers equals zero, only the opening lantern appears. For each higher tier, add a guiding lantern and double the entire fleet from the previous tier. Return an integer representing the total lanterns in flight when the parade ends.

Example 1:

Input: tiers = 0
Output: 1
Explanation: Only the first lantern glider is airborne.

Example 2:

Input: tiers = 3
Output: 15
Explanation: The third tier adds a lantern and repeats the earlier tiers twice.

Example 3:

Input: tiers = 5
Output: 63
Explanation: Five tiers follow the ritual, filling the sky with sixty-three lanterns.

00:00
Loading editor...
Test Results

Run your code to see test results

Click the Submit button to execute your solution

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.