Fibonacci Number - Leetcode 509 - Dynamic Programming (Python)

  Рет қаралды 8,877

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 26
@GregHogg
@GregHogg 4 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@galdali10
@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
@Rose-gb1ku Ай бұрын
BEST VIDEO to get started with DP. Thanks a lot
@omkarhatwalne3906
@omkarhatwalne3906 6 ай бұрын
Precise explanation, loved it!
@GregHogg
@GregHogg 6 ай бұрын
Glad to hear it 😊
@ryuhayabusa3540
@ryuhayabusa3540 6 ай бұрын
Very nice explanation, I used a decorator approach to improve performance, but your solutions are amazing
@GregHogg
@GregHogg 6 ай бұрын
Thank you so much! And yeah, I assume you mean the @cache decorator. Wanted to avoid that for coding interviews. Thanks a ton!!
@FrozenKnight21
@FrozenKnight21 5 ай бұрын
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.
@GregHogg
@GregHogg 5 ай бұрын
Uhm I don't think there is negative Fibonacci numbers
@Pradyumna_P
@Pradyumna_P 5 ай бұрын
I love how he said, The steps of dynamic programming : Step 1 - don't use dynamic programming 😂😂
@GregHogg
@GregHogg 5 ай бұрын
It's true and I'll absolutely stand by this
@ahsanhabibkhan6217
@ahsanhabibkhan6217 5 ай бұрын
Love the videos and shorts!
@GregHogg
@GregHogg 5 ай бұрын
Very glad to hear it, thank you :)
@dabisrat
@dabisrat 6 ай бұрын
Great video as always. I was curious why is the golden ratio solution log time? I figured it would be constant time.
@GregHogg
@GregHogg 5 ай бұрын
Thank you! It's because raising it to the power n is expensive
@JamesKalam
@JamesKalam 2 ай бұрын
where is that x comes from
@javedmiya3165
@javedmiya3165 6 ай бұрын
Can you upload complete one shot python (covering all things required for dsa)
@GregHogg
@GregHogg 6 ай бұрын
Yeah I've got that video just search for full python course Greg hogg
@ismaelherrera2978
@ismaelherrera2978 6 ай бұрын
sublime
@GregHogg
@GregHogg 6 ай бұрын
Haha awesome
@phanquan579
@phanquan579 6 ай бұрын
Cool!
@GregHogg
@GregHogg 6 ай бұрын
Awesome :)
@jakeschouten4331
@jakeschouten4331 6 ай бұрын
👍
@GregHogg
@GregHogg 6 ай бұрын
Ikr
@ayushdey5342
@ayushdey5342 6 ай бұрын
69th like... lets gooo
@GregHogg
@GregHogg 5 ай бұрын
Great number
Climbing Stairs - Leetcode 70 - Dynamic Programming (Python)
10:54
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 35 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,5 МЛН
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,7 МЛН
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 150 М.
Number of Islands - Leetcode 200 - Graphs (Python)
11:01
Greg Hogg
Рет қаралды 10 М.
Recursion for Beginners - Fibonacci Numbers
10:16
NeetCode
Рет қаралды 25 М.
Top K Frequent Elements - Leetcode 347 - Heaps (Python)
14:08
Greg Hogg
Рет қаралды 11 М.
House Robber - Leetcode 198 - Dynamic Programming (Python)
13:15
How I Failed the Google Coding Interview (and lessons I learned)
14:24
Counting Bits - Dynamic Programming - Leetcode 338 - Python
13:24
The Number of Beautiful Subsets - Leetcode 2597 - Python
32:34
NeetCodeIO
Рет қаралды 11 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН