Тёмный

Noob Recursive Backtracker vs Dynamic Programming Tabulator 

Greg Hogg
Подписаться 193 тыс.
Просмотров 676 тыс.
50% 1

FAANG Coding Interviews / Data Structures and Algorithms / Leetcode

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

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 453   
@dominikschweigl574
@dominikschweigl574 4 месяца назад
God tier wouldn't store the whole array which makes it O(n) space complexity. Instead only store previous two for O(1) space.
@weissgal1977
@weissgal1977 4 месяца назад
Exactly my first though
@rikthecuber
@rikthecuber 4 месяца назад
Technically, god-tier would use matrix exponentiation to get it in O(log n) time and O(1) space.
@GregHogg
@GregHogg 4 месяца назад
Absolutely correct:)
@TheJanstyler
@TheJanstyler 4 месяца назад
Is that really god tier? I'm a first year cs student and thought of that. Kinda feels like the most intuitive way to do it imo.
@dominikschweigl574
@dominikschweigl574 4 месяца назад
@@rikthecuber can you explain? Never heard of it
@kevinchandra280
@kevinchandra280 4 месяца назад
Mathematician: "Well, I'll just use the Binet's Formula."
@mattiamarchese6316
@mattiamarchese6316 4 месяца назад
It's a huge meme among the high school students attending LUISS lessons about competitive programming, each year the "know it all" ends up saying "I can get fib(N) in almost O(1)"
@z69b
@z69b 4 месяца назад
that still needs loops for the pow
@יצחקשלום-ל3י
@יצחקשלום-ל3י 4 месяца назад
I thought about it too 😮
@zoetorres1894
@zoetorres1894 4 месяца назад
​@@mattiamarchese6316it's closer to log n tho due to it being the fastest you can get the exponent
@vilmospalik1480
@vilmospalik1480 4 месяца назад
Exactly what I was thinking
@xevento8682
@xevento8682 4 месяца назад
Can't get over the fact that the "God-Tier" Programmer is concerned about time & space complexity and speed and then chooses to use Python of all languages lol
@GregHogg
@GregHogg 4 месяца назад
God tier python programmer I suppose 😂
@_Epidemic_
@_Epidemic_ 4 месяца назад
At least it isn’t Java or JavaScript
@xevento8682
@xevento8682 4 месяца назад
@@_Epidemic_ still faster than python most of the time but yeah, I'd have expected like c++
@808brotherstv4
@808brotherstv4 4 месяца назад
Just for fibonacci ?? Why not use a memoized recusive function and reduse speed from exponential to linear🤔🤔🤔
@xevento8682
@xevento8682 4 месяца назад
@@808brotherstv4 think he does that in another video actually. though it wouldn't surprise me if that was also in python.
@嘻嘻哈哈欸米奇
@嘻嘻哈哈欸米奇 4 месяца назад
Only 2 variables are needed. Overkill for using array😅
@GregHogg
@GregHogg 4 месяца назад
Yep, you're right!
@nonconsensualopinion
@nonconsensualopinion 4 месяца назад
Even then, if you're going to use an array, at least preallocate it.
@joshnjoshgaming
@joshnjoshgaming 3 месяца назад
Technically 3 for a swap, no?
@Kitsuinox
@Kitsuinox 3 месяца назад
​@@joshnjoshgaming you can also use the xor operator to swap two numbers without having to introduce another variable. will use more cycles, though
@嘻嘻哈哈欸米奇
@嘻嘻哈哈欸米奇 3 месяца назад
@@joshnjoshgaming There's a "slightly" more elegant way for using 2 variables only. It's a bit useless memory-wise tbh, but good for thinking.
@lucasct1426
@lucasct1426 4 месяца назад
For the Fibonacci sequence, if you just need a specific number of it, you can use matrix exponentiation and calculated really large indices very quickly
@GregHogg
@GregHogg 4 месяца назад
Yes absolutely right
@MengdaYang
@MengdaYang 4 месяца назад
is there a word in english for the god above god?
@MrMeztar
@MrMeztar 3 месяца назад
@@MengdaYang Yes, Computer Science Major :P
@Dd-do-and-dont
@Dd-do-and-dont 4 месяца назад
Dynamic programming 101. But, you could also use some kind of queue etc to store only last two elements :). I am to lazy for variables :)
@GregHogg
@GregHogg 4 месяца назад
You're right!
@flamendless
@flamendless 4 месяца назад
"god-tier" then proceeds to store a big list. And in python. Lol
@cptfwiffo
@cptfwiffo 2 месяца назад
And resizing the list continually
@addone9871
@addone9871 4 месяца назад
@GregHogg You can also represent linear sequence with a matrix and use fast exponantiation to get O(logn) time complexity with O(1) space complexity
@kjl3080
@kjl3080 4 месяца назад
Binet Eigenvalues my beloved
@robosapiens-yd1hb
@robosapiens-yd1hb 3 месяца назад
@@kjl3080 idk what that is. I solved it by manually deriving an f(2n) and f(2n-1) function in terms of f(n) and f(n-1) then just cached the immediate previous states. This resulted in O(log(n)) time and O(1) space. code: " def fib(self, n: int) -> int: f0 , f1, r0, r1, i = 1, 1, 0, 1, 1 while i
@trzepoczacy
@trzepoczacy Месяц назад
nah this is not entirely true, or even not true at all. Consider multiplication of big numbers (so like fib(n/2) * fib(n/2)) takes a lot of time.
@lucabasso6535
@lucabasso6535 Месяц назад
That’s noob ?!?! My lord I have an odyssey of a journey ahead of me 😂😂 but I’m all for it , fell in love with coding after looking at videos and stuff and had the urge for years , I quite hate my job so I said fuck it , I wanna learn and make a career out of this because even if it’s hard I find it incredibly fascinating
@kintr8597
@kintr8597 4 месяца назад
The most optimal is literally just using the formula: (((1+sqrt(5))/2)^n-((1-sqrt(5))/2)^n)/sqrt(5)
@markusklyver6277
@markusklyver6277 4 месяца назад
"I use Binet's formula, btw"
@gabrielushijima1525
@gabrielushijima1525 4 месяца назад
Loses precision for big n
@aertyty3900
@aertyty3900 4 месяца назад
​@@gabrielushijima1525do calculations in Q(√5)
@padraighill4558
@padraighill4558 4 месяца назад
@@aertyty3900 Just Q[x] / (x^2 + x - 1)
@aertyty3900
@aertyty3900 4 месяца назад
@@padraighill4558 x^2-x-1 *nerd* tho u dont even need generating functions or characteristics polynomials, because Q(sqrt(5)) is kinda intuitive due to similarity with complex numbers. Or just use matrices, it works just the same. But its better to use polynomials division for longer linear recurrences, cuz O(k^2logn) is better than O(k^3logn). I just like the idea of using Q(sqrt(5)), it can mathematically prove some very fun properties
4 месяца назад
you are absolute god expect you are appending all the useless values to list, instead of using using 2 variables
@Jjer.z
@Jjer.z 4 месяца назад
it's dp
@JonBristow
@JonBristow 4 месяца назад
Why can't you solve this in O(1)? It's possible, you "just" find the closest integer (round half up) where F(n) = phi^n / sqrt(5) where phi is the golden ratio [1+sqrt(5)]/2. You can grab the 1 billionth Fibonacci number if your language's number representation can handle arbitrarily large numbers.
@GregHogg
@GregHogg 4 месяца назад
You're right!
@yperm7627
@yperm7627 4 месяца назад
Exponential is not constant time
@JonBristow
@JonBristow 4 месяца назад
Nvm I can’t read
@JonBristow
@JonBristow 4 месяца назад
C’s ** algo is most certainly log(exponent)
@ayoubelktibi500
@ayoubelktibi500 4 месяца назад
u can literally solve that in O(log(n)) using maths
@khatriiedits3606
@khatriiedits3606 4 месяца назад
how?
@igorkaminski6543
@igorkaminski6543 4 месяца назад
Using fast matrix exponentation
@khatriiedits3606
@khatriiedits3606 4 месяца назад
@@igorkaminski6543 and what's that? Could you please elaborate more?
@Oscar1618033
@Oscar1618033 4 месяца назад
Or cleverly manipulating thr Catalan identity
@jonathandiaz8186
@jonathandiaz8186 3 месяца назад
This isn’t God Tier.. it might be better than the recursive because it’s not exponential but linear. But the space complexity is linear and could be constant: num1 = 0 num2 = 1 for loop.. temp = num2 num2 += num1 num1 = temp return num2 Something like that
@GregHogg
@GregHogg 4 месяца назад
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@mrCheeeseGuy
@mrCheeeseGuy 4 месяца назад
I would just write absolutely garbage and slow code but write it in a language like c++ or rust so it's fast. This may mean i am a noob programmer but i digress
@GregHogg
@GregHogg 4 месяца назад
Lmao yeah that works
@jonatansexdoer96
@jonatansexdoer96 4 месяца назад
Slow code is by definition still slow in "fast" languages
@jesroe5842
@jesroe5842 3 месяца назад
Oh i just did this. You're supposed to use the power of matrix (1,1;1,0)
@professornumbskull5555
@professornumbskull5555 3 месяца назад
FINALLY someone who know how to efficiently calculate Fibonacci sequence.
@trzepoczacy
@trzepoczacy Месяц назад
@@professornumbskull5555 its more efficient only if u want to calculate modulo
@raymaleh8851
@raymaleh8851 4 месяца назад
While I agree that storing the entire array is not needed for a single call to this function, if we make the array static (reusable between function calls), we effectively get a cache. At any point, if we have solved the problem up to size M and n M, we just append to our cache until we solve for n, making n the new largest solved problem. Assuming that the inputs follow some reasonable probability distribution without too heavy of a tail and are uncorrelated, then the runtime should converge to an average of O(1).
@rishabhshenoy3258
@rishabhshenoy3258 2 месяца назад
Those who don't know backtracking are real noobs😂😂
@adityasoni8924
@adityasoni8924 4 месяца назад
It's funny that my uni professor solved the fib question with recursion and I solved it with iteration on the test and I got a 0 for it. I talked with him, googled in the front of him to prove that it can be solved with a loop to get my marks on test.
@karstr770
@karstr770 4 месяца назад
Any recursive problem can be solved with a loop, this is programming 101 and does not need proving. Some problems are just more suited for recursive solutions. Maybe the requirement was to use a recursive approach?
@user-ip9dg4dt5e
@user-ip9dg4dt5e 4 месяца назад
Considering it's uni, the test probably meant to test certain subject and not so much on the result
@weissgal1977
@weissgal1977 4 месяца назад
Ask your professor if his implementation can do fib(100), Spoiler: it can't, unless it doing some internal cache
@GregHogg
@GregHogg 4 месяца назад
Wow that's brutal
@Scarybug
@Scarybug 4 месяца назад
First year programming is learning how to use recursion, second year programming is learning never to use recursion.
@EbrahimTahernejad
@EbrahimTahernejad 3 месяца назад
O(log(n)) time complexity is posible
@rugvedtamhan
@rugvedtamhan 7 дней назад
Wait so the for loop is a better approach than ressursion?
@Bunnokazooie
@Bunnokazooie 4 месяца назад
There's no backtracking in the recursive solution
@GregHogg
@GregHogg 4 месяца назад
Yeah that's kinda true. Moreso just naiive recursive solution
@chancefleeting6479
@chancefleeting6479 4 месяца назад
This is solvable in closed form…
@tomasbernardo5972
@tomasbernardo5972 4 месяца назад
Or you could just use something really cool called Binet's formula
@TheJmax04
@TheJmax04 4 месяца назад
(The recursive algorithm is not a backtracking algorithm)
@GregHogg
@GregHogg 4 месяца назад
Yeah I think I misspoke
@kolere23
@kolere23 4 месяца назад
Memoization anyone?
@GregHogg
@GregHogg 4 месяца назад
Oh yeah
@srijitdas5748
@srijitdas5748 4 месяца назад
Meanwhile me who can do it O(1) time
@gvenkatesh8935
@gvenkatesh8935 4 месяца назад
How?
@dahcus
@dahcus 4 месяца назад
​@@gvenkatesh8935 There's a closed form solution. Search for Binet's forumula
@Tiddle_s
@Tiddle_s 4 месяца назад
@@gvenkatesh8935JonBristow posted it below, there's a formula for calculating the nth fib number which is constant time.
@Mammothina
@Mammothina 4 месяца назад
@@Tiddle_s What is fun you can derive a comparable formula for any recursively defined sequence
@g3mint446
@g3mint446 4 месяца назад
Nice, meme. But for anyone serious about this. Part 1 was the god-tier programmer. Part 2 was the noob one.. It's called premature optimization, which is pointing and wrangling with stuff that just works fine. Programmers go from bad, to worse, to good. The good ones know to appreciate working code and some level of readability. Anything else usually just burns money.
@g3mint446
@g3mint446 4 месяца назад
Having that said! Being able to go from recursive to iterative is very useful. It doesn't take too much to buffer overflow. Just don't default to it. Default to simple and readable. It's an optimization. Always start with simple and readable. Always, always.. it works, it works... If you for some reason cannot understand that.. We must be on different planets.
@anto_fire8534
@anto_fire8534 3 месяца назад
This is not premature optimization.
@g3mint446
@g3mint446 3 месяца назад
@@anto_fire8534 I don't agree, good code is relative to needs and goals. Maybe you have an argument in there?
@anto_fire8534
@anto_fire8534 3 месяца назад
​@@g3mint446 This is not premature optimization, the quote is always misinterpreted when it's actually intended to talk about micro-optimizations. Here, the algorithm is changed to a more efficient one. Also, since we're talking about readability, I'd say the second algorithm is much more readable considering it's much closer to what an human would actually do to manually calculate the Fibonacci sequence instead of the recursive solution. Finally, saying the first solution "just works fine" is wrong in my opinion considering it runs in non-polynomial times when there exists many simple polynomial time solutions and the non-polynomial time solution is unable to be used in a real world context considering it gets so slow it can't calculate numbers past like 60-70 in a reasonable amount of time.
@g3mint446
@g3mint446 3 месяца назад
@@anto_fire8534 I have to agree with you there. But only if your team think it's the most readable and simple way to write code. If you don't have a clear need to rewrite readable code, why would you? I can do a million things to improve something, it doesn't mean I should. You get the most value from code that is readable, maintainable and working (not some smart ass genious, waste of time code). Some times you don't even need to read it again, it should just work. It is all about time management, and there are cases where scrapping the thing and making it just work is preferable to anything else. Anyone who call themselves an expert but cannot realize this, is not an expert (those people are lying to themselves). I have worked with horrible code and great code. I very much value simple code, but some times the code doesn't matter enough to be a priority, the project is, not the code. The project and the solution spec is the priority. That is what the Manager and the Customer has agreed on, and that is what they need you to help them with. Not a single thing beyond. If you have suggestions to do more, it should be clearly reported and discussed. That is my obligation as a developer. That is my job. Itching my brain and having arrogant opinions is not. I get work done fast and as ordered, that is my job. That is how I keep customers and managers happy. Not by being a genious. Your job is not your company, you don't decide how to run it.
@rutvikrana512
@rutvikrana512 3 месяца назад
Absolute god who doesn’t care about O(N) space and time taken for appending to list not to mention recreating if hit upper limit. 😂
@Jjer.z
@Jjer.z 4 месяца назад
Dynamic Programming 😍
@u9vata
@u9vata 2 месяца назад
Most God-tier is to use closed form - for extra points: I literally used the closed form in real life application - also the inverse of fibonacci (that is: getting back i from the value :-) )
@GPCTM
@GPCTM 3 месяца назад
Step aside, peasants. n = int(input("how many Fibonacci numbers do you want?")) x,y = 1,1 for i in range(1, n+1): print(x) x,y = y, x+y
@Doodle1283
@Doodle1283 4 месяца назад
This is decent for most real world applications but an O(n) algorithm is too lame to be called god tier imo. Use matrix exponentiation and we have O(logn).
@GregHogg
@GregHogg 4 месяца назад
Haha yep you've got a point
@DerHouy
@DerHouy 2 месяца назад
Then I'm a non-existent programmer because I don't know either solution haha
@parthrathod2607
@parthrathod2607 4 месяца назад
Wait why I feel like I'm learning wrong way I did exactly what is best and then I was taught to do recursion 😮 that's not right it's like the simpler the better
@juanmacass
@juanmacass 4 месяца назад
no, recursion is good. That program is badly done
@shalevforfor5550
@shalevforfor5550 Месяц назад
I got that question and couldn't solve it because he didn't let us use chatgpt which is very helpful I was learning from it and in Google there is diffrent approach for it with math but that good too
@I61void
@I61void 24 дня назад
Bruh i remember doing this question, its was one of my first. Took me like 3 hours because i was using c++ and i had only previous knowledge in JS. I solved it, tried to teach it to a friend after a week, brain fog, couldnt solve it. This was 8 months ago, i can solve medium and hard problems on leetcode, currently at 130 solved. I could solve most easy questions in under 5min. Crazy to think about.
@johnsudeep9021
@johnsudeep9021 4 дня назад
Fibonacci is the goto example for recursion. Sure it can be solved iteratively or linearly(Binet's formula), but at some point every god programmer solved it recursively. 😅
@johnsudeep9021
@johnsudeep9021 4 дня назад
Fibonacci is the goto example for recursion. Sure it can be solved iteratively or linearly(Binet's formula), but at some point every god programmer solved it recursively. 😅
@nagyzoli
@nagyzoli 11 дней назад
Fibonacci is tail recursive. You will gain nothing in forcing the liniar loop, it gets transformed to that internally by the CPU anyway. If you really want to go all in, you have an ugly but working mathematical solution. The problem reduces to gaining a precise implementation of SQRT.
@serzhredalert1
@serzhredalert1 4 месяца назад
using matrices you can achieve asymptotics O(log n)
@GregHogg
@GregHogg 4 месяца назад
Yes!
@wasile
@wasile Месяц назад
That's not recursivebacktracking. Call it just recursive.
@byronvega8298
@byronvega8298 4 месяца назад
And people who know math would do it in constant time and space complexity.
@krzysztofbigzygi9477
@krzysztofbigzygi9477 4 месяца назад
I don't get it ... I don't knew python... i love it ... (tis-100) - i would love to play other games like this
@rubyverma484
@rubyverma484 3 месяца назад
Im god tier then
@GregHogg
@GregHogg 3 месяца назад
Yeah you are
@shantanughosh655
@shantanughosh655 12 дней назад
Isnt the first approach just recursive and not recursive backtracking?
@_skf_2262
@_skf_2262 4 месяца назад
@GregHogg Actually if you write tail recursive functions you will get the same time and space complexity :) Stack recursive functions are bad of course
@GregHogg
@GregHogg 4 месяца назад
Excellent point!
@professornumbskull5555
@professornumbskull5555 3 месяца назад
The God tier would use Matrix based calculation for logarithmic space and time for the most optimal solution... My disappointment is immeasurable and my day is ruined.
@knowledgegoldmining
@knowledgegoldmining 15 дней назад
Use 2 variables to store the 2 nums , update with new values
@xCoolChoix
@xCoolChoix 3 месяца назад
Yk what I'll just multiply it by 1.618 every time in a loop and then round it off to the nearest whole number,
@42DQuinn
@42DQuinn 2 месяца назад
God tier would use just binet’s formula for constant time and space complexity.
@not_vinkami
@not_vinkami 4 месяца назад
When I see problems like these I tend to just solve it mathematically and throw in the general solution to get a O(1) space and about O(1) time code
@Ibra_
@Ibra_ 4 месяца назад
But there is no mathematical equation that can just get you the fibonacci number without knowing the 2 before
@not_vinkami
@not_vinkami 4 месяца назад
@@Ibra_ Binet's formula:
@stranger0152
@stranger0152 4 месяца назад
@@Ibra_ There is. You learn it in Linear Algebra courses in colleges. Actually any linear recursive defined function like fibonacci has general solution.
@Ibra_
@Ibra_ 4 месяца назад
I feel stupid for not knowing that. Thank you guys
@Tanukibetter
@Tanukibetter День назад
Me just starting to code yesterday listening to this sounds like hieroglyphs
@jackjorgensen17
@jackjorgensen17 3 месяца назад
Why are you appending to the list, wasted time resizing the list. why not initialise the entire array first, ans = [1] * n Or even better, use a deque from collections
@ShadowBoy609
@ShadowBoy609 4 месяца назад
Im an idiot in programming and I still wouldn’t do recursive backtracking lol
@GregHogg
@GregHogg 4 месяца назад
So not an idiot!
@calebkirschbaum8158
@calebkirschbaum8158 3 месяца назад
You can just calculate it using a formula for constant time. Sometimes doing it the better algorithmically way fails if you don't know the math.
@ИгорьБизюков-к6я
@ИгорьБизюков-к6я 2 месяца назад
I don't know how does it happens on your language, but in my language adding new element into dynamic array - it is very expensive operation.
@EyBossPusi
@EyBossPusi 3 месяца назад
This is too much for me my.brains gonna explode
@nw4009
@nw4009 2 месяца назад
I have no idea what any of this means but I’m looking forward to failing to ever truly understand what any of this means.
@inushuuun
@inushuuun 28 дней назад
I'm a software engineering student but I didn't understand anything I just saw, I need help.
@vampire_catgirl
@vampire_catgirl 2 месяца назад
I would use Binet's Formula personally
@anshumankhanna8296
@anshumankhanna8296 3 месяца назад
You can reduce the space complexity to O(1) bro, why didn't you
@srikarrar261
@srikarrar261 Месяц назад
I think I am the only one who started with Good-Tier programmer 1st and went to recursion 😂😂😂
@hashedone
@hashedone 3 месяца назад
It's not a god tier programmer, he just wasted sh*tload of memory instead of solving it in constant space.
@gamename9097
@gamename9097 14 дней назад
You can store only last two values then it’s constant memory complexity
@whyforyou12
@whyforyou12 14 дней назад
Which platform you're using can i know it if some one knows
@Yolosopher27
@Yolosopher27 3 месяца назад
broo wtf?!!! you look like my bro James more than my bro James looks like himself
@raphael714
@raphael714 Месяц назад
Wait till he learns about matrices
@howareyou4400
@howareyou4400 3 месяца назад
Or, we could overkill and do this in O(log n) time for the fancy points.
3 месяца назад
I'm pretty sure there are libraries that indexed a shit ton of prime numbers for you, o(1) lol.
@BZ123taken
@BZ123taken 2 месяца назад
I use recursive memoisation which is the same time complexity
@tigidou3344
@tigidou3344 5 дней назад
Python with typing.... it's that the joke. :-)
@astrahcat1212
@astrahcat1212 3 месяца назад
And then theres Titan God tier programmer: use an api thats optimized for you.
@viktorb137
@viktorb137 3 месяца назад
wat a ... Why! The first path is way too complicated and you put it in the noob section?
@ЮрийГладков-с7с
@ЮрийГладков-с7с 3 месяца назад
God tier whould use formula to calculate final value
@nano-sult9442
@nano-sult9442 3 месяца назад
God tier would use binary matrix exponentiation to get the answer in O(log n)
@samwasnotfound4
@samwasnotfound4 2 дня назад
Suffering from success
@LanceBurk
@LanceBurk 2 месяца назад
I know the god comment is a joke but lets be careful with our words
@rishujeetrai5780
@rishujeetrai5780 2 месяца назад
Binet's formul does it in O(1) time and space
@bboystrek4489
@bboystrek4489 26 дней назад
def fib(self, n: int) -> int: return ((byte) n & 1) == 2: 1
@ishtiaquekhan1148
@ishtiaquekhan1148 Месяц назад
There is no one worthy of worship except Allah
@magiccuttlefish
@magiccuttlefish 3 месяца назад
The god program is actually the noob at this point. Who thinks of recitation as a first option
@seand7603
@seand7603 19 дней назад
God tier would use a different lsnguage :)
@TipoOq
@TipoOq 3 месяца назад
God tier programming = i can do this in another way that looks cooler :D
@CenturyViral
@CenturyViral 2 месяца назад
... why are there more then 1 way to do something ? WHY!
@bro_codes
@bro_codes 2 месяца назад
I think it can be done in logn time using matrix multiplication
@juliansantos1900
@juliansantos1900 3 месяца назад
Bro... Int is not immutable you can do def fib(n): a = 0 b = 1 for i in range(n): a,b = b,a+b return a And it's faster
@shreehari2589
@shreehari2589 4 месяца назад
Two variables can do the job
@GregHogg
@GregHogg 4 месяца назад
Indeed they can!
@sandipdaw5023
@sandipdaw5023 2 месяца назад
How is that constant time? When looping through n 🙄
@farukyldrm8498
@farukyldrm8498 24 дня назад
why there is "class Solution"
@nk361
@nk361 3 месяца назад
I am sitting here glad the "God tier" solution was easy
@GregHogg
@GregHogg 3 месяца назад
That's awesome!
@ajuc005
@ajuc005 3 месяца назад
you just need 2 numbers why store all?
@EstrellaDelSur23
@EstrellaDelSur23 3 месяца назад
I hate how condescending your are
@nif4345
@nif4345 3 месяца назад
Use the (φ^n - (1-φ)^n)/√5 technique
@aayur2190
@aayur2190 10 дней назад
Noob writes more readable program 😂
@BCS-IshtiyakAhmadKhan
@BCS-IshtiyakAhmadKhan Месяц назад
Then comes the matrix exponentiation
@mostafaghobashy2724
@mostafaghobashy2724 2 месяца назад
bonus, using list comprehension
@TimOder
@TimOder 2 месяца назад
Legends use matrix exponentiating
@fahadali1372
@fahadali1372 3 месяца назад
You are not god god don’t need to go to bathroom read about Islam
Далее
Memoization Technique in Dynamic Programming (DP)
0:55
Making an Algorithm Faster
30:08
Просмотров 92 тыс.
Most Common Concepts for Coding Interviews
6:08
Просмотров 318 тыс.
This is a Better Way to Understand Recursion
4:03
Просмотров 45 тыс.
LeetCode was HARD until I Learned these 15 Patterns
13:00
How To Study Programming The Lazy Way
11:15
Просмотров 174 тыс.
Microservices are Technical Debt
31:59
Просмотров 374 тыс.
Is Computer Science still worth it?
20:08
Просмотров 351 тыс.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Просмотров 236 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 84 тыс.