BudiBadu Logo
00:00

Terraced Shell Count

Recursion Easy 0 views

The Terraced Shell Parade in Luminara Cove is a twilight ritual where stewards arrange polished shells along carved ledges. The tradition begins with a single illuminated shell resting on the lowest terrace. Before the audience arrives, a herald declares how many additional terraces the team will prepare. Each new terrace must receive one guiding shell at its edge so visitors can see where the steps begin. Once that shell is placed, the caretakers echo the glow of the previous terrace on both banks of the lagoon, mirroring every shell that was already present. The hillside seems to breathe as the pattern repeats from terrace to terrace.

Your task is to compute the total number of shells that the crowd will perceive by the time the procession is ready. The input is a non-negative integer called tiers, representing how many terraces follow the base layer. When tiers is zero, only the first shell is displayed. For every higher tier, the stewards always add one fresh shell for orientation, and the entire arrangement from the previous tier reappears twice, reflected across the shallow water channels. This ceremony never deviates from that cycle, regardless of how many performers participate or how windy the cove becomes.

Focus solely on the final count of glowing shells. Do not consider brightness or spacing. The value of tiers will fit within ordinary counting limits, and the result should be returned as an integer. Think of the outcome as the sum of the guiding shell for the current terrace plus the mirrored reprise of every shell that came before. That steady rhythm is what gives the Terraced Shell Parade its hypnotic charm.

Example 1:

Input: tiers = 0
Output: 1
Explanation: Only the original shell is shown.

Example 2:

Input: tiers = 1
Output: 6
Explanation: The new terrace adds one guiding shell and mirrors the earlier display twice.

Example 3:

Input: tiers = 3
Output: 36
Explanation: Three additional terraces mean another guiding shell plus twin reflections of everything from tier two.

Related Problems

No related problems found

Comments (0)

Join the Discussion

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

BudiBadu Logo

Terraced Shell Count

Recursion Easy 0 views

The Terraced Shell Parade in Luminara Cove is a twilight ritual where stewards arrange polished shells along carved ledges. The tradition begins with a single illuminated shell resting on the lowest terrace. Before the audience arrives, a herald declares how many additional terraces the team will prepare. Each new terrace must receive one guiding shell at its edge so visitors can see where the steps begin. Once that shell is placed, the caretakers echo the glow of the previous terrace on both banks of the lagoon, mirroring every shell that was already present. The hillside seems to breathe as the pattern repeats from terrace to terrace.

Your task is to compute the total number of shells that the crowd will perceive by the time the procession is ready. The input is a non-negative integer called tiers, representing how many terraces follow the base layer. When tiers is zero, only the first shell is displayed. For every higher tier, the stewards always add one fresh shell for orientation, and the entire arrangement from the previous tier reappears twice, reflected across the shallow water channels. This ceremony never deviates from that cycle, regardless of how many performers participate or how windy the cove becomes.

Focus solely on the final count of glowing shells. Do not consider brightness or spacing. The value of tiers will fit within ordinary counting limits, and the result should be returned as an integer. Think of the outcome as the sum of the guiding shell for the current terrace plus the mirrored reprise of every shell that came before. That steady rhythm is what gives the Terraced Shell Parade its hypnotic charm.

Example 1:

Input: tiers = 0
Output: 1
Explanation: Only the original shell is shown.

Example 2:

Input: tiers = 1
Output: 6
Explanation: The new terrace adds one guiding shell and mirrors the earlier display twice.

Example 3:

Input: tiers = 3
Output: 36
Explanation: Three additional terraces mean another guiding shell plus twin reflections of everything from tier two.

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.