Python Programming Practice: LeetCode #509 - Fibonacci Number

preview_player
Показать описание
In this episode of Python Programming Practice, we tackle LeetCode #509 -- Fibonacci Number:

The Fibonacci sequence is a sequence of numbers where each number is equal to the sum of the two numbers before it in the sequence. We are also given that the 0th Fibonacci number is 0 and the 1st Fibonacci number is 1.

Writing a function to find Fibonacci numbers is a common motivating example for learning about recursion in introductory programming courses.

This is an easy difficulty problem, so a naive approach like the basic recursive solution will work, but there will generally be faster solutions.

Python Programming Practice is a series focused on teaching practical coding skills by solving exercises on popular coding websites. Note that the solutions seen here may not be the most efficient possible.

I am not going to provide the full code in the video description for this series, since copy and pasting solutions is not in the spirit of doing coding exercises. It is intended that the video will help you think about problems, approaches and how to structure solutions so that you are able to code up a working solution yourself. .

Рекомендации по теме
Комментарии
Автор

What do you think about using list in place dictionary to store the Fibonacci series? I was thinking list is better because the keys here is the index

NitinSatish
Автор

I am new in python. The work you did there is helpful but can you please explain what is 'self'? and why did you use that?
It would be a lot helpful, thanks.

prottoymobin
Автор

Please make a video on how to stay consistent while programming, cause my confidence to fall down when I am not able to solve questions, please guide me on this please please

avknash
Автор

Hey Thanks a lot this content and please make more videos on competitive programming

avknash
Автор

Your are using a Class method, . please do the Fibonacci problem using def function so that, I can figure out the simple step not using a class method.. cuz I am a biggener thank you.

corneliollagas