Tidal Melody Chorus
On the Dawnward Coast, navigators rely on a nightly call called the Tidal Melody. It begins with a single base refrain that tells ships when to set anchor. Then wave-singers from surrounding coves add their own choruses, each with a distinct name, to reflect the tide's direction. The tradition keeps ships in sync with the moonlit currents, and the exact ordering of the calls must be preserved so no harbor responds out of turn.
When a chorus is added, the harbor master introduces that cove with "Lead: {name}", has the inner melody play through entirely, then signals a tidal echo by speaking "Echo: {name}" before repeating the inner melody once more. Finally the harbor master declares "Release: {name}" to indicate the cove has finished contributing. Each cove wraps the melody created by the coves closer to the base, so the first name in the list corresponds to the first cove outside the base refrain.
You are given a base refrain refrain and a list of cove names coves ordered from the closest harbor outward. Produce the complete performance as an array of strings describing every spoken line in order. If coves is empty, return an array containing only the base refrain. Otherwise, for each cove, wrap the inner performance with the three spoken lines and a second pass through the inner melody as described.
Example 1:
Input: refrain = "Hold position on the eastern bar.", coves = []
Output: ["Hold position on the eastern bar."]
Example 2:
Input: refrain = "Hold position on the eastern bar.", coves = ["Harrowside"]
Output: ["Lead: Harrowside", "Hold position on the eastern bar.", "Echo: Harrowside", "Hold position on the eastern bar.", "Release: Harrowside"]
Example 3:
Input: refrain = "Anchor near the copper reefs.", coves = ["Marlon", "Sera"]
Output: ["Lead: Marlon", "Lead: Sera", "Anchor near the copper reefs.", "Echo: Sera", "Anchor near the copper reefs.", "Release: Sera", "Echo: Marlon", "Lead: Sera", "Anchor near the copper reefs.", "Echo: Sera", "Anchor near the copper reefs.", "Release: Sera", "Release: Marlon"]
Algorithm Flow

Best Answers
class Solution {
public int count_melody_vowels(String s) {
int count = 0; String v = "aeiouAEIOU";
for (char c : s.toCharArray()) if (v.indexOf(c) != -1) count++;
return count;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
