Starlight Lantern Chain
This challenge becomes much easier once you know exactly what to keep, change, or count. In Starlight Lantern Chain, you are trying to work toward the right number by following one clear idea.
Calculate starlight lantern chain length A good way to think about it is to first understand what goes in, then what rule you must follow, and finally what shape the answer should have.
For example, if the input is tiers = 2, the answer is 7. The second tier adds a lantern and doubles the earlier glow. Another example is tiers = 0, which gives 1. Only the initial lantern shines.
This is a friendly practice problem, but it still rewards careful reading. The key is understanding the rule clearly and then applying it carefully.
One helpful habit is to say the rule out loud in your own words before you start solving. If you can explain what counts, what changes, and what the final answer should look like, you are already much closer to the right solution.
Example Input & Output
The second tier adds a lantern and doubles the earlier glow.
Only the initial lantern shines.
Three tiers preserve the pattern, revealing fifteen lanterns in total.
Algorithm Flow

Best Answers
class Solution {
public int find_longest_increasing_chain(int[] nums) {
if (nums.length == 0) return 0;
int maxLen = 1, current = 1;
for (int i = 1; i < nums.length; i++) {
if (nums[i] > nums[i-1]) current++;
else current = 1;
maxLen = Math.max(maxLen, current);
}
return maxLen;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
