merge: Optimize the space complexity of the fibonacci algo (#899) · TheAlgorithms/JavaScript@8bf29fe · GitHub
Skip to content

Commit 8bf29fe

Browse files
authored
merge: Optimize the space complexity of the fibonacci algo (#899)
* docs: update js doc * feat: add number type validation condition * pref: Optimize space complexity remove the Array from the algo and used two flag varible to calculate last two numbers & optimize the sapce complexity O(n) to O(1) * test: add test case for invalid types
1 parent 743b317 commit 8bf29fe

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

Lines changed: 16 additions & 8 deletions

Dynamic-Programming/tests/FibonacciNumber.test.js

Lines changed: 7 additions & 1 deletion

0 commit comments

Comments
 (0)