Code Logo

Windborne Lantern Parade

Published atDate not available
Easy 0 views
Like0

This problem feels like a little puzzle you can solve one step at a time. In Windborne Lantern Parade, you are trying to work toward the right number by following one clear idea.

Calculate windborne lantern parade pattern A good way to think about it is to first understand what goes in, then what rule you must follow, and finally what shape the answer should have.

For example, if the input is tiers = 5, the answer is 63. Five tiers follow the ritual, filling the sky with sixty-three lanterns. Another example is tiers = 3, which gives 15. The third tier adds a lantern and repeats the earlier tiers twice.

This is a friendly practice problem, but it still rewards careful reading. The key is understanding the rule clearly and then applying it carefully.

One helpful habit is to say the rule out loud in your own words before you start solving. If you can explain what counts, what changes, and what the final answer should look like, you are already much closer to the right solution.

Example Input & Output

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
Recommendation Algorithm Flow for Windborne Lantern Parade

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;
    }
}