We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba18e5d commit 4465a44Copy full SHA for 4465a44
lesson_07/conditionals/src/lesson7.ts
@@ -151,14 +151,14 @@ export function addNumbers(values: number[]): number {
151
*/
152
export function getFirstNFibonacciNumbers(n: number): number[] {
153
const list: number[] = [];
154
- const indices = Array.from({ length: n - 1 }, (_, index) => index + 2);
155
- if (n>=0){
156
- list.push(1);
157
- }
+ const indices = Array.from({ length: n - 2 }, (_, index) => index + 2);
158
if (n>=1){
159
list.push(1);
160
}
161
if (n>=2){
+ list.push(1);
+ }
+ if (n>=3){
162
for (const i of indices) {
163
list[i] = list[i - 1] + list[i - 2];
164
0 commit comments