mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): clarify Fibonacci user story to use 0-indexed sequence (#67195)
Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -13,9 +13,9 @@ dashedName: build-an-nth-fibonacci-number-calculator
|
||||
|
||||
1. You should create a function named `fibonacci`.
|
||||
2. You should define an array named `sequence` within the `fibonacci` function, and it should be initialized with the values `[0, 1]`.
|
||||
3. The `fibonacci` function should accept one parameter, a positive integer `n`.
|
||||
3. The `fibonacci` function should accept one parameter, a non-negative integer `n`.
|
||||
4. Calling `fibonacci(n)` should use a dynamic programming approach to compute and return the `n`-th number from the Fibonacci sequence, where each number is the sum of the two preceding numbers.
|
||||
5. Each computed number at the position `n` in the Fibonacci sequence should be stored in the `sequence` array at index `n - 1`.
|
||||
5. Each computed Fibonacci number should be appended to the `sequence` array.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@ dashedName: build-an-nth-fibonacci-number-calculator
|
||||
|
||||
1. You should create a function named `fibonacci`.
|
||||
2. You should define a list named `sequence` within the `fibonacci` function, and it should be initialized with the values `[0, 1]`.
|
||||
3. The `fibonacci` function should accept one parameter, a positive integer `n`.
|
||||
3. The `fibonacci` function should accept one parameter, a non-negative integer `n`.
|
||||
4. Calling `fibonacci(n)` should use a dynamic programming approach to compute and return the `n`-th number from the Fibonacci sequence, where each number is the sum of the two preceding numbers.
|
||||
5. Each computed number at the position `n` in the Fibonacci sequence should be stored in the `sequence` list at index `n - 1`.
|
||||
5. Each computed Fibonacci number should be appended to the `sequence` list.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user