Find The Longest Increasing Subsequence - Dynamic Programming Fundamentals

  Рет қаралды 157,731

Back To Back SWE

Back To Back SWE

Күн бұрын

Free 5-Day Mini-Course: backtobackswe.com
Try Our Full Platform: backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: Given an array of all integers that may or may not be sorted, determine the length of the longest subsequence that is strictly non-decreasing.
What Is A Subsequence?
A subsequence of an array is a subset of the array that maintains temporal order.
It does not have to be contiguous but it might turn out to be contiguous by chance.
Problem Name / Variants
This problem also comes in the form of asking for the longest strictly decreasing subsequence.
This is longest non-decreasing subsequence meaning that we will have a non-strictly increasing subsequence (aka we can have deltas of 0 between contiguous elements in the subsequence).
Approach 1 (Brute Force)
We can enumerate all 2^n subsets of the original array and then test them for the non-decreasing property.
The answer will be the longest subset that has the property.
This is too expensive.
Approach 2 (Dynamic Programming)
Do you see the potential for a subproblem here?
If you do, then we have the opportunity to use dynamic programming.
Example
[ -1, 3, 4, 5, 2, 8 ]
At the index 0 I always know that I can have a subsequence of length 1.
In fact, at all positions the longest non-decreasing subsequence can be at least length 1.
We then look at index 1, I need to ask myself if the item at index 1 can lengthen the longest subseqence found at index 0.
We check if 3 is greater than or equal to 1...it is. Great. index 1 can be tacked on but...should I?
The LNDS (longest non-decreasing subsequence) at index 1 is 0.
The LNDS at index 0 is 1.
Yeah...it makes sense because if I tack 3 onto the LNDS I found for the subproblem of just [ -1 ] then at index 1 I will also have a LDNS.
So what we basically do is build a table and ask ourselves these questions all along the way.
EACH CELL REPRESENTS THE ANSWER TO THE SUBPROBLEM ASKED AGAINST the subsequence from index 0 to index i (including the element at index i).
Complexities:
Time: O( n^2 )
n is the length of the array.
For each of the n elements we will solve the LNDS problem which takes O(n) time, therefore we yield a O( n^2 ) runtime complexity.
Space: O( n )
We will store our answers for each of the n LNDS subproblems.
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: / @hackerrankofficial
Tuschar Roy: / tusharroy2525
GeeksForGeeks: / @geeksforgeeksvideos
Jarvis Johnson: / vsympathyv
Success In Tech: / @successintech
++++++++++++++++++++++++++++++++++++++++++++++++++
This question is number 17.12 in "Elements of Programming Interviews" by Adnan Aziz, Tsung-Hsien Lee, and Amit Prakash.

Пікірлер: 604
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Table of Contents: (yes, I know I'm screaming. I messed up...this video is old...ok.) Me Talking (Who Cares) 0:00 - 0:28 The Problem Introduction 0:28 - 1:13 LIS vs. LNDS vs. LDS 1:13 - 2:48 The Approaches 2:48 - 4:38 Full Dynamic Programming Table Walkthrough 4:38 - 16:45 Applying This To Other Dynamic Programming Problems 16:45 - 17:18 Time Complexity 17:18 - 18:00 Space Complexity 18:00 - 18:13 Handling Dynamic Programming In The Interview 18:13 - 18:43 The Usual 18:43 - 19:01 This problem also has an O( n * log(n) ) solution which is faster than the O( n ^ 2 ) DP solution here: leetcode.com/problems/longest-increasing-subsequence/discuss/74824/JavaPython-Binary-search-O(nlogn)-time-with-explanation In my opinion, this isn't practical to pull off in an interview if you have never seen this question before and that is what matters to me. So I covered the O( n ^ 2 ) way since it is more reasonable. The code for this question (with exhaustive comments for teaching purposes) is in the description. It is for the Longest Increasing Subsequence problem. We talked about the Longest Non-Decreasing Subsequence.
@deepakpaliwal2200
@deepakpaliwal2200 5 жыл бұрын
can u tell from where i can learn dp. its too difficult to understand plz reply if u see this comment or make a video on this
@akhileshsingla3212
@akhileshsingla3212 5 жыл бұрын
@@deepakpaliwal2200 He has a playlist for DP.
@akhileshsingla3212
@akhileshsingla3212 5 жыл бұрын
Could you please sort the videos in DP playlist from easy to hard questions? It would be of great help!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
The book "Algorithm Design" by Kleinberg and Tardos is really good if you want a very deep understanding
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
I wanted to but never ended up doing it :(
@parthsawant9904
@parthsawant9904 3 жыл бұрын
Not all heroes wear capes, some wear glasses and a amazon tshirt too :D
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
lol
@utkarsh_goel
@utkarsh_goel 3 жыл бұрын
True :D
@user-zc8sq3wr9f
@user-zc8sq3wr9f 3 жыл бұрын
@@BackToBackSWE Down with Amazon!!! j.k.
@tianxiaowang3771
@tianxiaowang3771 5 жыл бұрын
"yes, we can" is very emotional. I will be very strong when I listen to this word. Feel that I can solve this algorithm question now! thanks, Ben
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hahahaha sure.
@yueli2146
@yueli2146 4 жыл бұрын
You must be a fan of Barack Obama then lol
@keeplearning5707
@keeplearning5707 5 жыл бұрын
the high spirit in your voice and the medium pace is really motivating and keeps our brain focused. thanks buddy for your favor.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hahahaha, I'm just shouting...didn't have a mic
@irvinge4641
@irvinge4641 4 жыл бұрын
@@BackToBackSWE was playing lofi in spotify and your loud voice sounded like its in syhnc with the beats
@maythecodesbewithyou29
@maythecodesbewithyou29 4 жыл бұрын
Learning from him :p
@BlokeBritish
@BlokeBritish 2 жыл бұрын
@@TejasM14 true
@mokim8435
@mokim8435 5 жыл бұрын
Love how this dude always answers the why questions to the small things compared to other people on youtube
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hey haha
@helloiam2mas
@helloiam2mas 4 жыл бұрын
Amen to this
@dangidelta
@dangidelta 4 жыл бұрын
Dude, you nailed it straight home, perfectly. I had been struggling with this problem for most of my Saturday afternoon. After a gruesome day of zero-progress and infinite hopelessness, the sheer joy and sigh of relief of finally having understood another concept is what made the evening a little better. Thanks !
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
haha nice, if you like this check out our coding interview class, I'm posting video like this frequently there
@dcodernz
@dcodernz 3 жыл бұрын
I like how consistent you go through the whole run of the algorithm. It really helps understand it.
@jonathanfoster5106
@jonathanfoster5106 4 жыл бұрын
Your videos are breaking certain things wide open for me that I've never seen before. Thanks man. I'm budgeting in time to watch at least one of your videos a night until I've seen them all
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@raghavendrasinghchauhan7704
@raghavendrasinghchauhan7704 4 жыл бұрын
One of the most energetic guys I found explaining DP. Thank you.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
lol, old video, sorry
@debrc
@debrc 3 жыл бұрын
The way you explained the problem is absolutely brilliant. Wasted my entire day on other videos. I'm following you for some months now, every video from you is absolutely Gold. More power to you!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
thx
@sar6575
@sar6575 3 жыл бұрын
o
@puperhacker2150
@puperhacker2150 5 жыл бұрын
The more I watch your videos, the more I think that this channel deserves to grow.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Hahahahaha, thanks and I know right? This isn't the most scalable content...I'm cooking up somethin'....just wait.
@ameynaik2743
@ameynaik2743 3 жыл бұрын
The amount of patience you have to explain this is commendable! Thanks!
@soz824
@soz824 5 жыл бұрын
Love your lectures and love your energy, thanks so much for making these!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@adhamsalama4336
@adhamsalama4336 3 жыл бұрын
Every time I encounter a problem and don't understand it, I go to this channel. Huge thanks to you for explaining things so clearly, King.
@frozen_tortus
@frozen_tortus 4 жыл бұрын
You are absolute mad-man by repeating those things. Thank you man, I can't believe you made me understund those things. Never stop!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@jerrywu5797
@jerrywu5797 5 жыл бұрын
Dude, you channel is growing quick. Now when I go to the discussion I'll first look for your user name bephrem. Thank you for all the helps!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hahahahaha, I want it to grow faster. Too slow for me. Thanks.
@MrQuaex
@MrQuaex 3 жыл бұрын
I was looking at leetcode discussion solutions for an hour trying to wrap my head around and understand it, but after watching this video it completely clicked and could code the problem with ease!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
great
@anonsurf6640
@anonsurf6640 4 жыл бұрын
Your explanations are so intuitive and clear. I feel like I am starting to have a good feel on this subject after watching your videos. Love your awesome work!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice!
@catherines4884
@catherines4884 5 жыл бұрын
You are a life saver! I cannot thank you enough for posting these!! Bless you!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@demagab
@demagab 4 жыл бұрын
Thank you for being so clear, specific and for explaining everything slowly. You're way better than my teacher!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@jjlian1670
@jjlian1670 4 жыл бұрын
Man, I went through 5 youtube videos and finally understand how to implement it from yours. You da best!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@amrithagopakumar
@amrithagopakumar 3 жыл бұрын
Thank you so much for this. This was of really great help and I must mention how the energy and positivity in your voice makes me really attentive.
@MaxVinstappen
@MaxVinstappen 4 жыл бұрын
Dude, the way you explain it (and your energy) really helps me absorb and understand this. Also the way you emphasize the key technique helps make it click.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@DennisSmdFreefightTrainer
@DennisSmdFreefightTrainer 4 жыл бұрын
I never find the 'code in the description'. In every single video I never find the code. Can you clarify where it is? Btw your are amazing and help me a lot, thanks!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
The repository is deprecated - we only maintain backtobackswe.com now
@wesiegel
@wesiegel 5 жыл бұрын
You did great. You did not mess up. You exhibited passion, which is very engaging to those in your audience. Great presentation.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@wh264
@wh264 3 жыл бұрын
Thanks for explaining the answers. I tried reading the explanations on blogs and leetcode, but they didn't click. Your videos already made things clicked for me and you teach the patten that I should recognize. DP is really hard for me for now, thanks for lessening the pain!
@zm5431
@zm5431 4 жыл бұрын
After literally months of trying to figure out DP, after this video I finally got it!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@shashwatagrawal8412
@shashwatagrawal8412 4 жыл бұрын
You are awesome dude ! I always felt DP was too complex but watching your vids have greatly simplified it !! Keep making more videos ! :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
no ur awesome
@MoaazAhmad
@MoaazAhmad 4 жыл бұрын
I rarely comment on videos, but I really appreciate your clear explanation. I was able to understand and code the solution based on your explanation by looking at your videos _just once_ - that's amazing! Keep up the good work! I'd love to donate/contribute to you once I pass my interviews at a Big N and get a job.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks! and nah u good, just get the job
@therawbean69
@therawbean69 4 жыл бұрын
You are better than 3/4th of the teachers I have studied from and one of the bests on online platforms! Keep going :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks and tahnks
@chemi590
@chemi590 4 жыл бұрын
Thank you so much for uploading this video. This helps me a lot, cuz I'm not good at dp.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@iliasp4275
@iliasp4275 4 жыл бұрын
i wish you could teach me every one of my classes! great teacher greeat structure , great video overall !
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
lol
@kiweilau7191
@kiweilau7191 4 жыл бұрын
bro you are really a good teacher who tech something more essential rather than just the solution
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ye
@micmicmw
@micmicmw 3 жыл бұрын
Honestly I like the loud voice you have. Wakes me up doing late night homework. Thank you tons can't wait to watch more videos.
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
great lol
@deadchannel-x2m
@deadchannel-x2m 4 жыл бұрын
So much passion and enthusiasm in your style of explaining things. Thanks, man! Was really helpful.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@smallcreativecorner5930
@smallcreativecorner5930 3 жыл бұрын
Wow. THE BEST explanation of dynamic programming approach for this problem. Good teaching skills are rare and you've got them. Thanks for this!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
thanks!
@shafeenmahmud8850
@shafeenmahmud8850 4 жыл бұрын
I love your energy and your videos For the dynamic programming videos like this one I think what you're missing is a section explaining what the core sub problem is, because that is the main challenge in dynamic programming, understanding the sub problem (which is not constant from problem to problem).
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ok
@yicai7
@yicai7 4 жыл бұрын
"Subproblem Subproblem Subproblem" Thanks Ben, now I'm feeling much more better about how to solve the DP questions By the way, I really like your T-shirt :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ye
@nirajchowdhary7372
@nirajchowdhary7372 5 жыл бұрын
Thanks a lot, buddy you not only cleared the concept of this problem but also the core of DP. Appreciate your efforts :D
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@endle_ss
@endle_ss 3 жыл бұрын
Teaching is an art and you have mastered it . Oh captain , my captain . It is just pure joy learning from you.
@marcossneijder
@marcossneijder 2 жыл бұрын
Finally someone could clearly explain (even to a non-native english speaker) this problem. I was beating my head against the wall because all explanations I've seen so far were difficult to understand, now I can easily understand the underlying code
@akankshajain3997
@akankshajain3997 4 жыл бұрын
recently started interviewing, your videos are very helpful for solving leetcode problems in the most efficient way, i was even able to attempt hard category question on an actual interview after watching your videos, keep these videos coming \m/
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great
@akankshajain3997
@akankshajain3997 4 жыл бұрын
@@BackToBackSWE can you please make a video about interleaving strings? The dynamic programming solution to the problem is a little difficult to understand and come up with.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
@@akankshajain3997 I can look into that but not sure I'll ever get to it
@DanDan-zs6wg
@DanDan-zs6wg 5 жыл бұрын
Great video! Thanks for taking the time to make this!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
love.
@howlowl7866
@howlowl7866 4 жыл бұрын
Man, thanks God I have found your channel, this is so easy to understand now.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@JustSkillGG
@JustSkillGG 5 жыл бұрын
Dude, just keep it up.. Awesome explaining I am absolutely sure that ur channel will explode
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@MySWESpace
@MySWESpace 4 жыл бұрын
Your videos are amazing, i love that you explain beyond just solving the problem. You're an amazing teacher
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thx
@MeizeT
@MeizeT 4 жыл бұрын
I struggled so much and your videos have really guided and helped me to clarity!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@Vaibhav101
@Vaibhav101 5 жыл бұрын
Amazing content. I love the delivery. Keep it up :)
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hahaha, I'm screaming but ok haha
@rohitpathak6084
@rohitpathak6084 4 жыл бұрын
The best I have come across. Good work guys. Thank you for this
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@leshwar4
@leshwar4 4 жыл бұрын
Love the way you go through explaining why the solution works!!! Thanks a lot!!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@benjaminbenny4819
@benjaminbenny4819 4 жыл бұрын
Its a very good video, helped me a lot, thank you. I like it that u tackle every question with the way thinking should be done in order to get it during interviews. Its very helpful.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks.
@devwriter8407
@devwriter8407 4 жыл бұрын
You are really amazing at explaining reasoning behind the solution. Thank you so much for your work.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@nikulpatel2319
@nikulpatel2319 4 жыл бұрын
Thanks Ben, I appreciate your time and efforts.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@munna0808
@munna0808 4 жыл бұрын
"Oooo, Amazon shirt, he must be good at computer science" lmaooo
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
my bad - old video, no one watched then
@riyastk1
@riyastk1 4 жыл бұрын
I could grab the solution straight away, very well explained, thanks!!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great.
@ChandraShekhar-by3cd
@ChandraShekhar-by3cd 4 жыл бұрын
Best Ever Explanation.You are just putting all the lights in the way to darkness to achieve the Algorithmic Destination.Keep posting such videos.And really appreciate the kind of effort you are putting to make these informative videos.Thanks
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@neosapien247
@neosapien247 3 жыл бұрын
I wrote my code based on this method all by myself. Pretty proud of the baby steps. Thank you!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
great
@vishaakravi1170
@vishaakravi1170 5 жыл бұрын
For this particular problem did the sub sequence not need to be contiguous? Since we took the first index and the last 4 indexes
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Yes, a subsequence does not have to be contiguous.
@enjili6062
@enjili6062 4 жыл бұрын
I really enjoy this guy yelling at me lol. Thanks dude for this video!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sorry, older videos had no microphone
@prayushdawda7807
@prayushdawda7807 5 жыл бұрын
Love your style! I feel smarter after watching your videos!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
haha nice
@hackytech7494
@hackytech7494 3 жыл бұрын
You are the best. There is no one on KZfaq who teaches fantastic as you
@minhnhatnguyen8065
@minhnhatnguyen8065 4 жыл бұрын
I just have started learn DP. But after see your video, I now comprehend how it work. Thanks for awesome explainning 😎
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@priyanshisharma536
@priyanshisharma536 3 жыл бұрын
thanks for the explanation of the algorithm....I got confused when i first saw the code, but watching the video, the idea behind it became clear :)
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
great
@Hav0c1000
@Hav0c1000 4 жыл бұрын
I wish I watched this before my Amazon interview today. Although, they took it even further, and asked for longest geometric subsequence. Soul crushed...
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ur good - you'll make it
@KaiBeatbox0803
@KaiBeatbox0803 3 жыл бұрын
Did you get your amazon shirt?
@foreverursabhi
@foreverursabhi 3 жыл бұрын
Let's test you on random sh*t you'll never rarely come across in your day job, how about that?
@mithunk9210
@mithunk9210 5 жыл бұрын
Your videos are very helpful! Thanks a lot!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@michaelsmitha
@michaelsmitha 5 жыл бұрын
Thank you for doing these, they are a big help! You might be getting a little "yell-y" with your recent videos :)
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Yeah, I know. A friend told me. I need to calm down haha.
@fernandomederos6689
@fernandomederos6689 4 жыл бұрын
wow finally got it your explanation is crystal clearr....keep up the good energy!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@samriniqbal5096
@samriniqbal5096 3 жыл бұрын
The way you explain things is so easy to understand. Thanks for doing this.
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
sure
@hiteshnagothu887
@hiteshnagothu887 4 жыл бұрын
Thanks for the Vid!! I was wondering if I could apply a bitonic sequence and an LIS on remaining sub-array, to find a longest N-shaped subsequence in an array (Increase - decreasing -increasing) !!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
not sure
@NarendraKolink
@NarendraKolink 5 жыл бұрын
This video is really helpful. It taught me how to approach complex dynamic programming problems very easily. thanks a lot.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@poorvathosar2556
@poorvathosar2556 4 жыл бұрын
Yeah same for me
@preetkamal7424
@preetkamal7424 3 жыл бұрын
Thanks a lot for the dp videos and all the other videos too :) It helped me a lot.
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
sure
@ytsersius
@ytsersius 5 жыл бұрын
thanks so much for this clear explanation!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@TheAdityaVerma
@TheAdityaVerma 5 жыл бұрын
please make a vedio on Longest Arithmetic Progression too!!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
ok, I'm making this rn: twitter.com/thebigoguide
@mrfrog20110607
@mrfrog20110607 5 жыл бұрын
Very clear explanation! Thanks a lot!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@graham12345dd
@graham12345dd Жыл бұрын
Well done! Quite a mouthful to handle at times, you did it well!
@shanulsingh6781
@shanulsingh6781 5 жыл бұрын
best way to make us understand. Keep going . Luv ur videos
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@SR-we1vl
@SR-we1vl 4 жыл бұрын
You put so much hard work to explain the concepts! You're the best!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
no u
@SR-we1vl
@SR-we1vl 4 жыл бұрын
@@BackToBackSWE You always reply! Thanks! You should now remember my name!
@callanambulancebutnotforme5702
@callanambulancebutnotforme5702 2 жыл бұрын
first min in and was amazed by the way of explanation . Truly Respectable!
@bitahasheminezhad2887
@bitahasheminezhad2887 5 жыл бұрын
Thanks for the video. Can I ask about O(nlog(n)) solution?
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
yeah, I'll try to cover it in the site I'm making: twitter.com/thebigoguide
@user-lb1fl7sh8m
@user-lb1fl7sh8m 5 жыл бұрын
Amazing man !! thanks a lot
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@unturned6066
@unturned6066 4 жыл бұрын
Nice. Thank you for going through the entire thing, and cutting out the non-important clips.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@mmfawzy4850
@mmfawzy4850 4 жыл бұрын
Perfect, great job, great explanation, I need to add one note it may add a value, I think having lower voice tone or frequency 🎶 will be better for listeners when listening for long time and several videos, just try to say the same with the same passion but lower tone .. Go on 👍🏼
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
yeah video sucks
@nandakumar1422
@nandakumar1422 4 жыл бұрын
This is my first comment on youtube, but really dude you are seriously the best, loved your explanation... simple and clear, great job man keep it up :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@omerfu
@omerfu 2 жыл бұрын
How can I find the longest non-decreasing subsequence if there is a limit for the repeating number? (Say the array is {1,1,1,1,1} and max repeat is 3. How do I make it so that it returns 3 as answer?
@sky76570
@sky76570 5 жыл бұрын
Keep up the good work! I
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
love.
@siddharthkhandelwal933
@siddharthkhandelwal933 8 ай бұрын
Only because of you i can understand dynamic Programming. Your one video explanation is sufficient to solve multiple other problems.
@BackToBackSWE
@BackToBackSWE 7 ай бұрын
Happy Holidays 🎉 Thank you for your kind words, Siddharth! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40
@Carlos-sy7cv
@Carlos-sy7cv 3 жыл бұрын
Thank you for the informative video. There's also a solution that uses a 2d array as a memo. Do you have a video or explanation on that?
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
We don't
@daleprather3026
@daleprather3026 3 жыл бұрын
I actually love that you're screaming. I can feel the passion. That's one things that makes your videos great. Please don't become dry and all "professional" with future videos or with the content on your website. That's too boring. You make the topics exciting and fun. That's contagious. Keep it up. And people, please go check out his leetcode-like website backtobackswe.com. It's awesome. So impressed you did this all while in college.
@nishanth998
@nishanth998 4 жыл бұрын
video is awesome .but i have one doubt..as per dp table value at index i tells longest non decreasing subsequence..so for eg see the value at index 4...it says 2..but we can have a length of 4 right??
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
hey can you clarify more?
@MoonlightAlpha
@MoonlightAlpha 3 жыл бұрын
Great explanation!! Very helpful in learning how dynamic programming works.
@samirkutty4760
@samirkutty4760 5 жыл бұрын
Thanks man! The explanation was clear as crystal. Question, so the O(n^2) solution only gets you the length of longest subsequence and not the sequence itself?
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
"so the O(n^2) solution only gets you" what do you mean by that
@samirkutty4760
@samirkutty4760 5 жыл бұрын
Back To Back SWE oh what I mean is, is there a way to find the sequence itself from the O(n^2) solution? The brute force method would get us the longest subsequence and the length. Eg.We would get all the possible subsets and return the longest subset that follows the principle array[i] > array[j]
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
@@samirkutty4760 yeah... I forgot how though...something about marking when you lengthen the sequence...it's been a while since I looked at this problem and did this video
@armaanpathan1856
@armaanpathan1856 2 жыл бұрын
Someone give this man a noble price...🙌❤
@BackToBackSWE
@BackToBackSWE 2 жыл бұрын
haha thanks mate! subscribe to our DSA course with a flat 30% discount for some amazing content b2bswe.co/3HhvIlV
@brahimmahioussi2428
@brahimmahioussi2428 Жыл бұрын
Thank you so much for this video , I was stuck to solve this problem ,but after watching your video the problem seems easy now for me
@BackToBackSWE
@BackToBackSWE Жыл бұрын
that's great to hear! There are other questions at - backtobackswe.com/ - Would love some feedback
@AnikG22
@AnikG22 3 жыл бұрын
Your videos are awesome, you explain beyond just solving the problem. It's really good.
@arunsudharsan7437
@arunsudharsan7437 5 жыл бұрын
Very nice explanation bro! thanks for the video!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@vishalimanivannan7109
@vishalimanivannan7109 4 жыл бұрын
After watching this video, it took me just 10 min to arrive at a solution for box stacking problem. **sentimental sobs**
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great
@chaitanyakulkarni6012
@chaitanyakulkarni6012 4 жыл бұрын
dude ur energy is superb that helps understanding better
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ha ok
@ashleywilkonson386
@ashleywilkonson386 3 жыл бұрын
Shouldn't those iterator names be swapped?
@jdavis6355
@jdavis6355 3 жыл бұрын
*When you take too much preworkout before teaching plebs dynamic programming.* Good vid lol, need to learn more of this stuff
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
lol sorry - old video
@jdavis6355
@jdavis6355 3 жыл бұрын
@@BackToBackSWE Honestly if you did a mini series of tutorials that were over the top extreme like those old school monster truck commercials... That would be legendary... would have to have visual effects!
@MuditSen1234
@MuditSen1234 2 жыл бұрын
I saw this problem as a graph problem and did a DFS. Sort of worked out for me. Still watching this video to get better insights though. Need help with the time complexity?
The 0/1 Knapsack Problem (Demystifying Dynamic Programming)
20:30
Back To Back SWE
Рет қаралды 203 М.
The Longest Increasing Subsequence
16:59
Spectral Collective
Рет қаралды 52 М.
마시멜로우로 체감되는 요즘 물가
00:20
진영민yeongmin
Рет қаралды 35 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 62 МЛН
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 53 МЛН
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 9 МЛН
The Change Making Problem - Fewest Coins To Make Change Dynamic Programming
23:12
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
LeetCode 300. Longest Increasing Subsequence - O(n log n)
10:24
Kacy Codes
Рет қаралды 4,5 М.
16. Dynamic Programming, Part 2: LCS, LIS, Coins
58:44
MIT OpenCourseWare
Рет қаралды 50 М.
Это - iPhone 16 и вот что надо знать...
17:20
Overtake lab
Рет қаралды 132 М.
Лазер против камеры смартфона
1:01
Newtonlabs
Рет қаралды 713 М.
#samsung #retrophone #nostalgia #x100
0:14
mobijunk
Рет қаралды 10 МЛН