Skip to content

Commit 6f0de19

Browse files
authored
Fixed Fib recursive
1 parent 69bbe51 commit 6f0de19

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Maths/Fibonacci.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,10 @@ const FibonacciRecursive = (number) => {
4444
case number + 1:
4545
return list
4646
default:
47-
list.push(
48-
sgn ?
49-
list.at(-2) - list.at(-1)
50-
:
51-
list.at(-1) + list.at(-2)
52-
)
47+
list.push(list.at(-1) + list.at(-2))
5348
return FibonacciRecursive(number)
5449
}
55-
})()
50+
})().map((fib, i) => fib * (sgn ? (-1) ** (i + 1) : 1))
5651
}
5752

5853
const dict = new Map()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy