Glacier Signal Fires
Imagine signal fires spreading across icy mountain ridges in a repeating pattern. At the very beginning, there is only one fire. Then each new ridge makes the pattern grow using the total from the stage before it.
Your job is to calculate how many fires are burning after a given number of ridges. This is a growth-pattern problem, so the answer comes from understanding how one stage changes into the next. The examples show that the total grows quickly, which means each new ridge is adding much more than just one extra fire.
For example, when ridges = 0, the answer is 1. When ridges = 2, the answer is 13. By the time ridges = 4, the total reaches 121. Those jumps show that the pattern is being built from the previous result again and again.
The important part is finding the rule that links each ridge count to the next one. Once you understand that growth rule, you can compute the total for any valid input.
Example Input & Output
Four responding ridges keep the rule, ending with one guiding fire plus triple the blaze from ridge three.
The second ridge adds a beacon and repeats the earlier lights three times.
Only the opening signal burns.
Algorithm Flow

Best Answers
class Solution {
public int glacier_signal_fires(Object input) {
int ridges = (int) input;
return (int)((Math.pow(3, ridges + 1) - 1) / 2);
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
