Master Data Structures & Algorithms For FREE at AlgoMap.io!
@galdali10Ай бұрын
Great video! There is another way to solve it by using matrices; take the matrix[[1, 1], [1, 0]] and raise it to the power of n, then multiply it (from the right) by the column vector (1, 0) and take the lower row of this resulting vector. It will be in O(n) run time (to raise the matrix to the nth power (assuming one 2×2 matrix multiplication is in O(1))) and the space complexity is O(1)
@Rose-gb1kuАй бұрын
BEST VIDEO to get started with DP. Thanks a lot
@omkarhatwalne39066 ай бұрын
Precise explanation, loved it!
@GregHogg6 ай бұрын
Glad to hear it 😊
@ryuhayabusa35406 ай бұрын
Very nice explanation, I used a decorator approach to improve performance, but your solutions are amazing
@GregHogg6 ай бұрын
Thank you so much! And yeah, I assume you mean the @cache decorator. Wanted to avoid that for coding interviews. Thanks a ton!!
@FrozenKnight215 ай бұрын
I kinda did this diffrently, but i guess it amounts to the same thing. I used an array, with a window, fulled in the first few values, then worked my way backwards. However, i had to later update it because i didnt realize there are negative fibanati numbers, and computing them is similar but a little trickier. But i did find a good work arround in the end.
@GregHogg5 ай бұрын
Uhm I don't think there is negative Fibonacci numbers
@Pradyumna_P5 ай бұрын
I love how he said, The steps of dynamic programming : Step 1 - don't use dynamic programming 😂😂
@GregHogg5 ай бұрын
It's true and I'll absolutely stand by this
@ahsanhabibkhan62175 ай бұрын
Love the videos and shorts!
@GregHogg5 ай бұрын
Very glad to hear it, thank you :)
@dabisrat6 ай бұрын
Great video as always. I was curious why is the golden ratio solution log time? I figured it would be constant time.
@GregHogg5 ай бұрын
Thank you! It's because raising it to the power n is expensive
@JamesKalam2 ай бұрын
where is that x comes from
@javedmiya31656 ай бұрын
Can you upload complete one shot python (covering all things required for dsa)
@GregHogg6 ай бұрын
Yeah I've got that video just search for full python course Greg hogg