BudiBadu Logo

Windborne Lantern Parade

Array Easy 5 views
Like29

The Windborne Lantern Parade begins with a single lantern glider. For each new "gust tier" that joins, a leading lantern is added, and every lantern from the previous tier splits into mirrored paths, doubling the fleet. Your goal in Windborne Lantern Parade is to compute the total number of lanterns in flight after a set number of tiers.

The "secret sauce" here is a Recursive Growth Pattern. If tiers is zero, only the first glider is airborne. For every higher tier, the formula follows: Total = 1 + (Previous Total * 2). This reflects how the wind sends the earlier lanterns circling back in unison like twin echoes. To observers on the bridges, it looks like a steady rhythm of new arrivals and past trails. You must return an integer representing the final count, ensuring the air lanes remain clear! It’s a beautiful way to practice modeling growth with simple recurrence.

When the task involves connectivity or route cost, build adjacency carefully and guard against revisiting stale states. Use a visited or best-distance structure to avoid repeated work, and ensure unreachable scenarios return the required fallback value instead of partial traversal results.

Examples

Example 1
Input
tiers = 5
Output
63
Explanation

Five tiers follow the ritual, filling the sky with sixty-three lanterns.

Example 2
Input
tiers = 3
Output
15
Explanation

The third tier adds a lantern and repeats the earlier tiers twice.

Example 3
Input
tiers = 0
Output
1
Explanation

Only the first lantern glider is airborne.

Algorithm Flow

Recommendation Algorithm Flow for Windborne Lantern Parade - Budibadu
Recommendation Algorithm Flow for Windborne Lantern Parade - Budibadu

Best Answers

java
class Solution {
    public int windborne_lantern_parade(int tiers) {
        int result = 1;
        for (int i = 0; i < tiers; i++) {
            result = 1 + 2 * result;
        }
        return result;
    }
}