BudiBadu Logo
00:00

Cascade Step Chimes

Recursion Easy 0 views

At Silvervein Falls, musicians arrange bronze chimes along a stepped overlook carved into the cliff. The performance always begins with a single chime at the base landing. Before twilight, the conductor announces how many additional steps will join the show, and apprentices climb to each new riser. Every added step starts with one guiding chime so the players know where to focus, then the echoes from the previous step are fanned out threefold by the water-worn stone, creating a layered harmony that feels both new and familiar.

The ceremony never rushes. As soon as a fresh step receives its guiding chime, the full soundscape from the level beneath is repeated three times, filling the gorge with echoes that flutter across mossy walls. None of the musicians improvise here—their job is to preserve the precise structure that locals trace back to the earliest harvest festivals. Whether the evening draws a handful of travelers or an entire caravan of traders, the same rule holds: place one new chime, then allow every earlier chime to return in triplicate.

Your role is to compute the total number of chimes the audience hears when the last step finishes ringing. The input, steps, is always a non-negative integer describing how many terraces follow the base landing. Output a single integer equal to the total chimes produced once the echoes settle. Ignore timing, resonance, or wind; you only need the count created by that dependable pattern of one guiding note plus three times the previous soundscape for each additional step.

Example 1:

Input: steps = 0
Output: 1
Explanation: Only the base chime plays, so the crowd hears a single note.

Example 2:

Input: steps = 2
Output: 17
Explanation: The second step adds one guiding chime and repeats the prior soundscape three times, ending with seventeen chimes.

Example 3:

Input: steps = 4
Output: 161
Explanation: Four additional steps mean another guiding chime plus a tripled echo of everything below, totaling 161 chimes.

Related Problems

No related problems found

Comments (0)

Join the Discussion

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

BudiBadu Logo

Cascade Step Chimes

Recursion Easy 0 views

At Silvervein Falls, musicians arrange bronze chimes along a stepped overlook carved into the cliff. The performance always begins with a single chime at the base landing. Before twilight, the conductor announces how many additional steps will join the show, and apprentices climb to each new riser. Every added step starts with one guiding chime so the players know where to focus, then the echoes from the previous step are fanned out threefold by the water-worn stone, creating a layered harmony that feels both new and familiar.

The ceremony never rushes. As soon as a fresh step receives its guiding chime, the full soundscape from the level beneath is repeated three times, filling the gorge with echoes that flutter across mossy walls. None of the musicians improvise here—their job is to preserve the precise structure that locals trace back to the earliest harvest festivals. Whether the evening draws a handful of travelers or an entire caravan of traders, the same rule holds: place one new chime, then allow every earlier chime to return in triplicate.

Your role is to compute the total number of chimes the audience hears when the last step finishes ringing. The input, steps, is always a non-negative integer describing how many terraces follow the base landing. Output a single integer equal to the total chimes produced once the echoes settle. Ignore timing, resonance, or wind; you only need the count created by that dependable pattern of one guiding note plus three times the previous soundscape for each additional step.

Example 1:

Input: steps = 0
Output: 1
Explanation: Only the base chime plays, so the crowd hears a single note.

Example 2:

Input: steps = 2
Output: 17
Explanation: The second step adds one guiding chime and repeats the prior soundscape three times, ending with seventeen chimes.

Example 3:

Input: steps = 4
Output: 161
Explanation: Four additional steps mean another guiding chime plus a tripled echo of everything below, totaling 161 chimes.

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.