Fern Spiral Growth
Imagine a tiny fern that grows in a curling spiral. At the start, it has just one little frond. Then each new turn of growth makes the shape bigger by building from what was already there.
Your job is to figure out how many glowing fern pieces exist after a certain number of turns. This is a recursive pattern problem, which means each new step depends on the earlier one. Instead of starting from nothing every time, the fern keeps using its old shape and growing from it.
For example, when turns = 0, the answer is 1 because only the center frond exists. When turns = 2, the answer is 7. By the time you reach turns = 4, the fern has grown a lot more and reaches 31.
This problem is really about noticing how the pattern grows from one step to the next. Once you understand how one turn leads to the next turn, the numbers stop feeling random and start feeling like a growing story.
Example Input & Output
The second turn adds one frond and mirrors the earlier growth twice.
Only the central frond has opened.
Four turns preserve the rule, leaving thirty-one fronds glowing in moonlight.
Algorithm Flow

Best Answers
class Solution {
public int calculate_fern_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.
