Moonlit Orchid Bloom
This challenge becomes much easier once you know exactly what to keep, change, or count. In Moonlit Orchid Bloom, you are trying to work toward the right number by following one clear idea.
Calculate orchid bloom pattern recursively 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 rings = 5, the answer is 63. Five rings follow the pattern, yielding sixty-three glowing orchids. Another example is rings = 0, which gives 1. Only the central orchid opens.
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
Five rings follow the pattern, yielding sixty-three glowing orchids.
Only the central orchid opens.
The second ring adds one blossom and reflects the earlier blooms twice.
Algorithm Flow

Best Answers
class Solution {
public int calculate_orchid_height(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
int[] dp = new int[n + 1];
dp[1] = 1;
for (int i = 2; i <= n; i++) {
dp[i] = i + dp[(i-2)];
}
return dp[n];
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
