Тёмный

Coding Interview Question - Nth Fibonacci 

AlgoExpert
Подписаться 5 тыс.
Просмотров 11 тыс.
50% 1

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@ericbezault
@ericbezault 2 года назад
There is a small mistake in the video at 18:14. `fib6` should be calling `fib5` and `fib4`, and not `fib5` and `fib5`.
@sweatysweatson9399
@sweatysweatson9399 4 года назад
Hey Clement, how is it going? I've been preparing for internships using algoexpert and sometimes there are some questions that I can't find the answer for. I was wondering if there is a facebook group or something so student could ask their question from you or your team?
@SaddamHossain-vg4qe
@SaddamHossain-vg4qe 4 года назад
I think, initial value for counter should be 2 and the base case check while returning will be n>=1. // time: O(n) | space: O(1) func fib(N int) int { lastTwo := []int{0, 1} counter := 2 for counter = 1 { return lastTwo[1] } return lastTwo[0] } Thank you very much for the tutorial!
@edwinontiveros8701
@edwinontiveros8701 3 года назад
one may also optimize a little bit in both space and time complexity if you assume any number below or equal to 2, except 0, will always return 1. fib(int n) { if(n == 0) return 0; else if ( n
@geetusharma3923
@geetusharma3923 4 года назад
I code in java , Is java walkthrough also available ??or how can I get idea of java code for ques ? I am confused , please help .
@alexandernguyen-phuoc8579
@alexandernguyen-phuoc8579 Год назад
how does one know to put n ==2 return 1 or n==1 return 0? like was it base on the first two value being 0, 1 and we just gave it the == 1 and 2 based on the fib(n-1) and fib(n-2) in that order?
@purpleraccoon8866
@purpleraccoon8866 2 года назад
There is also a very cool O(log n) solution by using matrix exponentiation
@in3135
@in3135 4 года назад
Why you define your fibonacci function with n > 2 ? If you check everywhere, the fibonacci sequence is defined with n > 1, so f(1) = 1 and not 0.
@iitnakanpur..
@iitnakanpur.. 5 лет назад
Love from india. Great content. BRo!
@remyaonampally8811
@remyaonampally8811 5 лет назад
Very helpful video 👍
@attamjotsingh4474
@attamjotsingh4474 5 лет назад
Awesome video
@josephwong2832
@josephwong2832 4 года назад
Thanks Clem
@farhaadkhan4780
@farhaadkhan4780 4 года назад
Am I the only one who learned this in 9th grade java class but had no idea this could be asked in an real interview?
@panabogdanliviu8126
@panabogdanliviu8126 2 года назад
You know there is a formula for this soo if you would be asked ever to do this (most unlikely) what's stopping you from using the formula? soo you will have a const time :)))
@tejasjivarak4024
@tejasjivarak4024 4 года назад
Upload all programs
@monkeytrollhunter
@monkeytrollhunter 4 года назад
;_; I paid $100 and this video is on RU-vid :( But I find the videos to be helpful. can you make more videos pls?
@thomasjust2663
@thomasjust2663 4 года назад
This website is a waste of money, save your self some and learn to code by yourself, you don't need these so called experts to help you "ace" the interview, if you know how to code, your knowledge will come thru
@monkeytrollhunter
@monkeytrollhunter 4 года назад
Uh, everyone learns how to code by themselves. You just learn the basics from school or whatever source you find at first. Then you learn on your own as you code more by getting stuck, hitting the brick wall, struggling, asking questions on stackoverflow, googling for things etc. AlgoExpert certainly helps you to perform better in technical interviews. Even when you're a cs major, it's hard to know everything. The problem is there are all kinds of problems and there is not enough time.
@baggier
@baggier 3 года назад
thats how i know you dont know dafuq u talkin about :)
Далее
Coding Interview Question - River Sizes
43:47
Просмотров 11 тыс.
Ребенок по калькуляции 😂
00:32
aespa 에스파 'Whiplash' MV
03:11
Просмотров 11 млн
Coding Interview Question - Largest Range
26:32
Просмотров 21 тыс.
Think Fast, Talk Smart: Communication Techniques
58:20
Google Coding Interview With A Competitive Programmer
54:17
What Is Dynamic Programming and How To Use It
14:28
Просмотров 1,6 млн
Ребенок по калькуляции 😂
00:32