| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Better O(n) time
There was a problem hiding this comment.
I like the proposed solution. IMO it's easier to understand. Just have one small nit below
Sorry, something went wrong.
| // For clarification: curr stands for current. This is standard syntax | ||
|
|
||
| for (let i = 2; i <= count; i++) { | ||
| let curr = firstPrev + secondPrev; | ||
| secondPrev = firstPrev; | ||
| firstPrev = curr; |
There was a problem hiding this comment.
Just one more small change please. Can we go for current instead of curr and remove the comment? This exercise is fairly early in the curriculum and I want the variable names to be as clear as possible for the learners. Thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
Done
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM 🚀
Sorry, something went wrong.
Update fibonacci-solution.js
Update fibonacci-solution.js
Update fibonacci-solution.js
Update fibonacci-solution.js
Update fibonacci-solution.js
| Back | FazBrowse Home | New Git URL |
More optimized solution with O(1) memory usage