Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fib - ms #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fib - ms #32

wants to merge 2 commits into from

Conversation

marshi23
Copy link

No description provided.

@shrutivanw
Copy link

Nice work on the algorithm.
I didn't see any comments on the time and space complexity. Take some time to practice deducing it and explaining the reasoning behind your answers.

Can you think of a way to tweak your algorithm so that the space complexity is improved? Hint: Do you really need to keep track of all of the fibonacci numbers in the array? Through each iteration in the loop, you only need the previous two fibonacci numbers. Could you save them in two integer variables and update them through each iteration of the loop? Give it some thought, then compare your solution with mine on https://github.com/Ada-C10/fibonacci/blob/solution/lib/fibonacci.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants