#๐ Why in fibanacci lecture , the lecturer wrote 1 and 2 on f(3) and f(2)
35 messages ยท Page 1 of 1 (latest)
@gusty widget
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Because fib(3) is 2 and fib(2) is 1.
f(2) = f(2-1) + f(2-2)
f(2) = f(1) + f(0)
f(2) = 1 + 0
f(2) = 1
substitute 3 in
f(3) = f(3-1) + f(3-2)
f(3) = 1 + 1
f(3) = 2
oh yeh
fug
I got it
I forgot to subsitute it
No, f(3-1) is f(2) that is 1
its f(2) + f(1)
yeh I wrote it directly
f(3) = f(2) + f(1)
f(2) = 1
f(1) = 1
f(3) = 1+1
f(3) = 2
is it right?
yes
yeh got I got it
thank you guys @lofty depot @rustic python
I apperciate the help
๐
Looks like you're learning recursion and memoization?
yes sirr , just started DSA
Cool!
๐ ๐จโ๐ป
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.