Canyon Echo Verse
The technical objective is to determine the total number of lines echoing in a stone amphitheater after a specific sequence of layered vocal performances. The chant begins with an initial narrator line, and each subsequent layer adds a new guiding verse, while the canyon walls replicate the entire previous chorus twice—once from each side.
Specifically, the total count of verses $f(n)$ follows the squared geometric progression $f(n) = (2^{n+1}-1)^2$ (where $n$ is the number of echo layers). This pattern emerges because the ritual doubles both the length and the width of the performance's vocal presence, creating a perfectly balanced rhythmic structure. The solution must provide a precise integer count for any non-negative integer of layers, enabling storytellers to maintain the exact cadence required for Crescent Canyon traditions.
Examples
Only the narrator speaks, so one verse is heard.
The second layer adds a verse and repeats the earlier chorus twice.
Four layers continue the same pattern, leading to forty-nine verses echoing through the canyon.
Algorithm Flow

Best Answers
class Solution {
public int count_echo_verses(int layers) {
int base = (1 << (layers + 1)) - 1;
return base * base;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
