Longest Increasing Subsequence O(n log n) dynamic programming Java source code

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 240

  • @ericfricke4512
    @ericfricke4512 3 роки тому +48

    1:22 "To understand how it works, let's develop our intuition..." Man, I wish more math and computer science teachers would be better at this.

    • @stablesort
      @stablesort  3 роки тому +3

      I hear you. Thanks for leaving a few good words.

    • @spencerkhalid4579
      @spencerkhalid4579 3 роки тому

      I know Im asking randomly but does someone know of a way to get back into an instagram account?
      I somehow forgot the login password. I appreciate any tricks you can give me!

    • @dashdoom8452
      @dashdoom8452 3 місяці тому

      so true, this is the most important part to understanding and it is usually completely skipped over for some reason

  • @mr.curious1537
    @mr.curious1537 Рік тому +2

    Such a wonderful explanation in such less time, I have already wasted 20 min of reading in order to understand this, but understood it, in just 5 min.

  • @madhivarman508
    @madhivarman508 4 роки тому +9

    The demo with the card is where exactly I understood "How the algorithm works?". Before watching this video, went through various other videos but couldn't understand the pointer concept correctly. A little graphical content makes learning better. Thanks for this video

    • @stablesort
      @stablesort  4 роки тому

      Awesome, thanks for the good words!

  • @pkgo1122
    @pkgo1122 4 роки тому +48

    I cam here from other channel's comment section,
    Not going back now...

    • @stablesort
      @stablesort  4 роки тому +1

      I am glad to hear that you found this video useful =)

    • @mindyourbusiness46
      @mindyourbusiness46 4 роки тому +21

      Lol. Let me guess... Tushar Roy??

    • @daniekpo
      @daniekpo 4 роки тому +3

      @@mindyourbusiness46 😂

    • @siddharthmagadum16
      @siddharthmagadum16 3 роки тому +3

      @Hank Hudson Okay stop sending this same message to every educational video. or are u a bot.

  • @maridavies3425
    @maridavies3425 4 роки тому +63

    Awesome. That’s the best explanation of finding the longest increasing subsequence I’ve seen. Thanks for the video!

  • @Yo-gh1cx
    @Yo-gh1cx 4 роки тому +50

    I like how 100th of club is designed

    • @stablesort
      @stablesort  4 роки тому +6

      I am more of a software engineer and not much of a graphics designer so I am happy to hear that the image made sense =)

  • @annas8308
    @annas8308 4 роки тому +26

    There are only 2 UA-cam videos explaining the problem in O(nlogn) time. Your explanation is very clear and you are awesome!

    • @stablesort
      @stablesort  4 роки тому +34

      Thanks! Believe it or not, I started this channel because I could not find a tutorial on how to solve the Longest Increasing Sequence in O(n log n). This was the very first video. Now I am just exploring subjects that I find neat, or I am simply curious about. Stay tuned and I hope you'd find other episodes interesting as well!

    • @aditya234567
      @aditya234567 4 роки тому +2

      @@stablesort THANK YOU SOO MUCH!!!!!!!!!

  • @uddeshyaagrawal2182
    @uddeshyaagrawal2182 3 роки тому +3

    I can't believe 23 people have disliked this video. In my opinion, this is the best possible explanation for this solution. Thanks for the video !!

  • @mike-yj5mm
    @mike-yj5mm 3 роки тому +1

    I keep coming back to watch this again time over time. The best explanation of the algorithm of all time.

    • @stablesort
      @stablesort  3 роки тому

      Thanks, I do appreciate your feedback!

  • @rhutshab
    @rhutshab 2 роки тому +2

    this channel is so underrated

  • @nobsreviews8814
    @nobsreviews8814 3 роки тому +3

    I really appreciate the graphics, and your calm voice. You are very relaxed for someone whose last name is VIOLENTey

    • @stablesort
      @stablesort  3 роки тому +1

      Haha, thanks for the compliment! Yeah, the last name is a bit of a spelling conundrum... It should have been spelled "Veeolentyev", but I guess when my family was immigrating, no one knew enough English to crosscheck for possible word/meaning collisions =)

    • @nobsreviews8814
      @nobsreviews8814 3 роки тому

      Haha that sounds like an algorithm problem in itself!

    • @stablesort
      @stablesort  3 роки тому

      @@nobsreviews8814 True! 8-P

  • @anandsrikumar007
    @anandsrikumar007 3 роки тому +1

    I solved it. I understood the problem after looking at your cards example, the example made this algorithm clear for me.

    • @stablesort
      @stablesort  3 роки тому

      Glad to hear that it was helpful!

  • @vineetbhargava4141
    @vineetbhargava4141 3 роки тому +2

    the best explanation so far for longest increasing subsequence problem in nlgn time.

    • @stablesort
      @stablesort  3 роки тому

      I do appreciate your good words! Cheers!

  • @adrijachakraborty2316
    @adrijachakraborty2316 4 роки тому +5

    Phenomenal explanation of LIS! I couldn't find any video describing why patience sort actually works for LIS! Amazing work sir! Thank you for your time and contribution for spreading the knowledge.

    • @stablesort
      @stablesort  4 роки тому +1

      You are very welcome! Thank you for such a wonderful compliment!

  • @narihanellaithy7726
    @narihanellaithy7726 4 роки тому +23

    Simple, concise and the best explanation of longest increasing subsequence! Subscribed :) We need more of this!

    • @stablesort
      @stablesort  4 роки тому +2

      Thank you for the compliment! One thing I forgot to mention in the video is that a complete implementation of it using Java is linked in the description.

  • @ale9507
    @ale9507 3 роки тому +2

    Brilliant explanation.
    Getting to understand the intuition behind algorithms is what gets me to truly appreciate computational thinking.
    These videos are orders of magnitude more beneficial than explanations of only the implementation.
    Thank you.

    • @stablesort
      @stablesort  3 роки тому

      Glad to hear it and thanks for the compliment!

  • @playerunknown1117
    @playerunknown1117 2 роки тому

    I have much appreciation for the one making this video. The algorithm is very simple with image illustration making things easy to understand. Even though, I think there is a problem in your proof. The main thing needs to be hold is "the longest increasing subsequence." "Card n+1 must go into some pile on the right" doesn’t lead to anything

  • @ShabnamKhan-cj4zc
    @ShabnamKhan-cj4zc 3 роки тому +5

    Awesome explanation.. Even a laymen can understand the logic thats what a good teachers does.. Thanks a lot for explaning in Easy way and with game

    • @stablesort
      @stablesort  3 роки тому

      Thanks for the compliment! Glad to hear that you enjoyed the video =)

  • @PhoenixRisingFromAshes471
    @PhoenixRisingFromAshes471 4 роки тому +6

    WOw sir,you made my day.I came to your video after the lonegest sub sequence problem

    • @stablesort
      @stablesort  4 роки тому +1

      Thanks! Your comment gives me inspiration to make more videos! By the way, any suggestions as to what topic to cover next?

    • @PhoenixRisingFromAshes471
      @PhoenixRisingFromAshes471 4 роки тому

      @@stablesort you should make more videos on other algorithmic paradigns like greedy,dynamic programming (mainly cause i sucks at dp)

    • @stablesort
      @stablesort  4 роки тому +1

      @@PhoenixRisingFromAshes471 I hear you. There are definitely a few DP algorithms that are on my to-do list. I try to prioritize those for which I could not find a good, succinct tutorial. And especially the topics that people asked for specifically.

  • @semajxocliw
    @semajxocliw 3 роки тому +2

    thank you kind man for preventing me from failing my final semester of CS

    • @stablesort
      @stablesort  3 роки тому

      Great to hear that my little video made such a good impact! I am also a little surprised that this problem would be on a final exam... This is not an easy problem to figure out in a time frame of an exam... In any case, cheers!

  • @benmontgomery1111
    @benmontgomery1111 2 роки тому

    Hands down, the best explanation I've seen on UA-cam

  • @chelseali9725
    @chelseali9725 3 роки тому +5

    Really good explanation! Watched twice and finally understand the concept. I like your example and pace of talk (very calm, clear but also cheerful, and the pauses is neat). Subscribed!

    • @stablesort
      @stablesort  3 роки тому

      Sweet! Thanks for the feedback and thanks for subscribing!

  • @rohitashwanigam
    @rohitashwanigam 3 роки тому +2

    Nice explanation. Thanks.
    For the case where an element is equal to previous, we can just point to the same place where the previous element had pointed to.
    Ofcourse, this is when you want longest increasing subsequence.
    If you are looking for longest non-decreasing subsequence, just point to the equal element itself.

  • @dorondavid4698
    @dorondavid4698 3 роки тому +1

    Damn, that's impressive.
    Most dp algorithms are n*m, so n log n is a nice improvement!

  • @navidr2811
    @navidr2811 4 роки тому +1

    best explanation of this problem so far I came across

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment!

  • @SeyhunSaryldz
    @SeyhunSaryldz 4 роки тому +2

    This video is the best explanation for the longest increasing subsequence I have seen. Thank you a lot for it, I enjoyed a lot, and we hope we can see more videos from you.

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment! I am working on the next one as we speak. By the, if you have suggestions for video topics, please do let me know. Cheers!

    • @SeyhunSaryldz
      @SeyhunSaryldz 4 роки тому +1

      ​Thank you​. I am looking for an explanation for "splitting non-negative integer array to m subarray while minimizing the largest sum among this m subarray".

    • @SeyhunSaryldz
      @SeyhunSaryldz 4 роки тому +1

      @@stablesort The DP solution, there are not enough contents only for the DP solution.

    • @stablesort
      @stablesort  4 роки тому

      @@SeyhunSaryldz Roger that. Thank you for the suggestion (as well the one about DP content).

  • @weizhou8888
    @weizhou8888 3 роки тому +2

    Never got disappointed whenever I spent n minutes of time on this channel where 0

    • @stablesort
      @stablesort  3 роки тому

      Glad to hear that there was at least 1 minute that was worthwhile =)

  • @oscarmvl
    @oscarmvl 2 роки тому +1

    Great explanation! Thanks for demonstrating why the algorithm provides the optimal solution.

  • @HetThakkar809
    @HetThakkar809 2 роки тому +1

    Thank you for including proof of correctness in your video. It really helped convince my stupid little brain

  • @shourabhpayal1198
    @shourabhpayal1198 3 роки тому +1

    Please keep posting more videos. Every video is top quality.

  • @abhinavraut3099
    @abhinavraut3099 4 роки тому

    Came here from the comment section, a short tour of code would've been better. Loved the video thanks

    • @stablesort
      @stablesort  4 роки тому +1

      Agreed and thanks for the feedback. This was my very first video. Most episodes that followed do have a code walk through. By the way, there is a source code linked in the description.

  • @ayyubshaffy3612
    @ayyubshaffy3612 4 роки тому +7

    I watched it 3 times and finally understood!!
    This video was awesome :) (u earned a sub!)

  • @oribenez
    @oribenez Рік тому

    One of the best explanation on LIS with time complexity of nlogn. Thanks in advance❤🙏🏼

  • @wh264
    @wh264 4 роки тому +1

    probably the clearest explanation I've seen. Thanks!

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment!

  • @tonystarc9567
    @tonystarc9567 3 роки тому +1

    What a peaceful explanation.

  • @abdulkk49
    @abdulkk49 3 роки тому +1

    Crisp, Clear & Brilliant!

  • @ShaunYCheng
    @ShaunYCheng 3 роки тому +1

    Appreciate the brief video. Action packed!

    • @stablesort
      @stablesort  3 роки тому

      Thanks, I appreciate your compliment!

  • @GreenMarkoulis13
    @GreenMarkoulis13 4 роки тому +2

    Great video. U should do more, their quality is ideal and very much needed

    • @stablesort
      @stablesort  4 роки тому +1

      Thanks for the words of encouragement!

  • @rihamkatout2679
    @rihamkatout2679 Рік тому

    Wow !!
    A lot of thanks, I've been searching for 2 hours, your explanation is short and so clear.
    You are amazing !

  • @highruler2786
    @highruler2786 4 роки тому +5

    Brilliant! The way you illustrated the problem with cards, piles and pointers in such a neat and timely matter finally made me understand the logic needed to find the Longest Increasing Subsequence! I struggled a bit to actually implement the algorithm, but now that I have I feel like I've gained the mastery needed to explain this to others if need be. Well done! As for suggestions, what about the Partition problem where the goal is to divide an array of integers in two such that the sums of the two array parts are as equal as possible? I would love an explanation of that!

    • @stablesort
      @stablesort  4 роки тому +1

      I am glad to hear it =). And thanks for the suggestion about the partition problem. I haven't heard it before and it sounds interesting. I'll give it a shot!

    • @stablesort
      @stablesort  4 роки тому +1

      Here you go, as promised: ua-cam.com/video/7BynUy5ml0I/v-deo.html

    • @highruler2786
      @highruler2786 4 роки тому +1

      @@stablesort That's awsome! I'm glad you also found the easies hard problem interesting :) Great video!

    • @stablesort
      @stablesort  4 роки тому +1

      @@highruler2786 Yeah, it's fascinating stuff. I am currently playing around with algorithms for partitioning into not just 2, but M number of partitions. And this turns out to be also a very interesting topic. It has practical implications, such as operating system handing out tasks to M number of CPUs on a computer, with each task having some specific cost. Thanks again for suggesting the topic!

    • @highruler2786
      @highruler2786 4 роки тому

      @@stablesort That's very cool! I'll be sure to see what you come up with in your next episode. And you're very welcome. Is so nice to see your explanation of a problem I've struggled with.

  • @mrmrigank7154
    @mrmrigank7154 13 днів тому

    awesome explanation to give the intuition, now I just have to think about finding the right pile in logn for each card, and nice shirt btw!

  • @zhambyl1454
    @zhambyl1454 4 роки тому +2

    Please, keep making videos. Your explanations are the best

  • @PallNPrash
    @PallNPrash 3 роки тому

    I love this channel and how complex algorithms are explained so clearly....Thank you SO much!! And please keep adding more videos.

  • @puneetkumarsingh1484
    @puneetkumarsingh1484 4 роки тому

    Extremely Clear Explanation! Please upload lots of these.

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment! By the way, if you have suggestions as to what other comp. sci. topics you'd like to view, please do let me know. Cheers!

    • @puneetkumarsingh1484
      @puneetkumarsingh1484 4 роки тому +1

      @@stablesort Sir, videos on the following topics will be very helpful.
      1.Optimal Binary Search Tree.
      2.Huffman Decoding and encoding
      3.Assembly Line Scheduling
      4.Maximum Bipartite Matching
      5.Push Relabel Algorithm(Related to flow algorithms)
      6. Johnson's Algorithm(Shortest Path)
      I hope its not too much!

    • @stablesort
      @stablesort  4 роки тому

      @@puneetkumarsingh1484 This is perfect, thank you. Some of these I only have a vague recollection of so it'll be fun for me to research into. By the way, as far as Optimal Binary Search Tree topic, one of the ways to achieve this is via "Treap" data structure - you may be interested in viewing this video I made a while back: ua-cam.com/video/uwWOUAdOTig/v-deo.html

    • @puneetkumarsingh1484
      @puneetkumarsingh1484 4 роки тому

      @@stablesort Thanks I will surely watch it. Other than this, I know that it is also solved using Dynamic Programming.

  • @sagargaddam3445
    @sagargaddam3445 4 роки тому +2

    This was awesome. Simple and clear explanation. Do more videos plz. Thank you.

    • @stablesort
      @stablesort  4 роки тому

      Thanks, will do! By the way, got any suggestions for a topic? I am always looking for a subject that hasn't been done yet (or done by not well)?

  • @GubenkovED
    @GubenkovED 4 роки тому +8

    the best explanation i've seen so far, very good job!

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment!

  • @sonalskitchen1320
    @sonalskitchen1320 3 роки тому +4

    Very well explained , and with good examples. Thanks for your effort.

  • @ciachn
    @ciachn 2 роки тому

    This is so cool! I lost an exercise in a contest because I had to use segment trees, and those are awful. - I wish I had known this! 😅😅😅

  • @yasser_hussain
    @yasser_hussain 3 роки тому +1

    I have rarely had this much fun learning a difficult algorithm like this. Hope you expand your operations. 😁

  • @chetanraikwar3546
    @chetanraikwar3546 3 роки тому +1

    The name of this channel is vety interesting. . . *Stable Sort* 😀

    • @stablesort
      @stablesort  3 роки тому

      Yeah, perhaps I should actually make a video on what it means =)

  • @RitikKumar-dm7eo
    @RitikKumar-dm7eo 4 роки тому +2

    Greatest Explanation Ever I saw

  • @manojkvn2632
    @manojkvn2632 4 роки тому +1

    Awesome explanation of concept behind algorithm, which helps in coding and remembering algo easily , Please continue the great work

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the compliment. In case you need it, there is also java source code, linked in the description. Cheers!

    • @manojkvn2632
      @manojkvn2632 4 роки тому +1

      @@stablesort I have checked the algorithm and seems self explanatory , just a suggestion can replace m = l + (r - l) / 2; to m=(l+r)/2 ie., (low+high)/2 since the previous is confusing.

    • @stablesort
      @stablesort  4 роки тому +1

      @@manojkvn2632 Done, thanks for the suggestion. I like your formulation better =)

    • @CrazyDreamer1001
      @CrazyDreamer1001 4 роки тому +1

      They both work when l and r are small compared to the range of the data type used, but m=(l+r)/2 will cause overflow for large values while l + (r - l) / 2 will not. That's why that one should be used in real code.

    • @stablesort
      @stablesort  4 роки тому

      @@CrazyDreamer1001 Good point! Perfect example of the need to do peer code reviews and testing. I totally did not think about that scenario. Thanks for pointing this out.

  • @raffaelemannarelli1747
    @raffaelemannarelli1747 Рік тому +1

    beautiful explanation

  • @RitikKumar-dm7eo
    @RitikKumar-dm7eo 4 роки тому +1

    Kindly keep uploading more such concept

    • @stablesort
      @stablesort  4 роки тому

      Thanks! By the way, please do let me know if there is a subject that you'd like me to make a video about. I am always looking for new ideas. Cheers!

  • @EduardoSernaL
    @EduardoSernaL 3 роки тому +1

    This is an amazing explanation! Thank you so much for the intuition section!!!!

  • @doppelganger2545
    @doppelganger2545 2 роки тому +1

    Great set of videos with clear and succinct explanations. @Andrei, any plan to add more content in the future?

    • @stablesort
      @stablesort  2 роки тому

      I have the plans just haven't had much time lately... But I definitely want to add to the series.

  • @vishalmishra7018
    @vishalmishra7018 3 роки тому +1

    Beautiful explanation.

    • @stablesort
      @stablesort  3 роки тому

      Thanks for watching and leaving a compliment!

  • @AshishRawat-zl6te
    @AshishRawat-zl6te 4 роки тому +3

    It's a really amazing way to explain. I really loved it. Please keep up this good work.

    • @stablesort
      @stablesort  4 роки тому +1

      Thank you! I'll do my best as time permits =)

  • @haaarshiiiit
    @haaarshiiiit 4 роки тому +1

    Excellent video ! Please keep making more of these.

  • @shahzadqadir5191
    @shahzadqadir5191 2 роки тому

    Great video, very helpful to understand the concept of increasing subsequence.

  • @joshika5391
    @joshika5391 4 роки тому +1

    Amazing explanation and insightful illustrations! Thanks a bunch!

  • @shikharchaudhary6984
    @shikharchaudhary6984 4 роки тому +1

    the explanation was just amazing

  • @user-uh3zr7mo4i
    @user-uh3zr7mo4i 3 роки тому +1

    You earned a sub sir :)
    You have a way of teaching I suggest you to pick difficult/ tricky questions from leetcode and start explaining on your channel.
    I guarantee you, your channel will explode.

    • @stablesort
      @stablesort  3 роки тому

      That's a great suggestion, thanks! If only I could have more time these days for hobbies =)

  • @dmanrox2
    @dmanrox2 Рік тому

    I know binary search was mentioned at the end but it would have been nice to explain with the visualization that since the top card on the piles are strictly increasing, we can do binary search over them to find the next pile, which is how we can guarantee O(nlogn) time.

  • @AL-jr7zu
    @AL-jr7zu 4 місяці тому

    Thank you, I loved this video. It was short and simple.

  • @jessiew4271
    @jessiew4271 3 роки тому +1

    Thank you so much!! Such a clear explanation!

  • @nqz3
    @nqz3 9 місяців тому

    man this solution is so good

  • @waisrainy
    @waisrainy 4 роки тому +1

    MAKE MORE CONTENT.
    Great work.

    • @stablesort
      @stablesort  4 роки тому

      Thanks! More episodes are in the making =)

  • @HS-dv1fv
    @HS-dv1fv 4 роки тому +1

    its really nice explanation.but I wanna know how to write a code.so it would be better to show your code examples.
    Anyway, its the best explanation I've ever watched!!Thank you!!

    • @stablesort
      @stablesort  4 роки тому

      Thanks for the suggestion. Most of my other videos do discuss the specifics of implementations. For this one, however, the source code is linked in the description.

    • @HS-dv1fv
      @HS-dv1fv 4 роки тому +1

      @@stablesort Oh!Sorrry!I missed it!!Thank you so much!!!

  • @arthurd4012
    @arthurd4012 2 роки тому +1

    Great, I just coded this up! :)

  • @gabhinav001
    @gabhinav001 2 роки тому +1

    Could someone explain how we can retrieve the Longest Increasing Subsequence(LIS) from the piles formed above? I did not understand the pointer concept thoroughly, though I understand that there will be Longest Increasing Subsequence(LIS) in the above decks. To be more precise, how do we determine which card we pick from each pile to be included in the LIS?
    Thanks in advance!

  • @ValentynPonomarenko-h8k
    @ValentynPonomarenko-h8k 8 днів тому

    Thank you for clear explanation.

  • @muditsingh2313
    @muditsingh2313 4 роки тому +1

    Thanks! This is the best explanation I ever had

  • @amitbendkhale646
    @amitbendkhale646 4 роки тому +2

    Really great video, lot of insight provided there!

  • @HAL--vf6cg
    @HAL--vf6cg 8 місяців тому

    If someone's not convinced, think of it this way:
    You can never include 2 numbers from the same pile in an increasing subsequence. If I take A and B from the same pile (and let's say B came after A), then B

  • @ahanapanja3372
    @ahanapanja3372 3 роки тому +1

    Brilliant!! Thank you.

  • @AADIL997
    @AADIL997 4 роки тому +1

    thanks for such a wonderful explanation

  • @nbenari
    @nbenari 4 роки тому +1

    Awesome work. Thanks!

  • @ShavkatRakhmonov-nb6su
    @ShavkatRakhmonov-nb6su Рік тому

    Thank you a lot for the video! Why you have stopped posting videos? They are amazing!

  • @kshitijgupta6976
    @kshitijgupta6976 3 роки тому +1

    very good explanation.
    it will be great if you also show code.
    find link of this video in leetcode LIS solution discussion

    • @stablesort
      @stablesort  3 роки тому

      Thank you, I do appreciate your feedback. This was my very first video made. Since then pretty much all of the other videos have some code walk through. Cheers!

  • @anonymoussloth6687
    @anonymoussloth6687 2 роки тому

    if we wanted to sort using this strategy, it would take nlogn to make the piles plus O(max pile size) to merge the k piles right?

  • @alexweaver9068
    @alexweaver9068 Рік тому

    Very good explanation, thank you.

  • @u2blr
    @u2blr 3 роки тому +1

    Thank you so much for making those amazing videos.

    • @stablesort
      @stablesort  3 роки тому

      Thanks for the compliment!

  • @HimanshuSharma-tm2ms
    @HimanshuSharma-tm2ms 4 роки тому +3

    Very well explained , thanks a lot:)

    • @stablesort
      @stablesort  4 роки тому

      Thanks for watching and thanks for leaving a nice comment =)

  • @red_and_black_UA
    @red_and_black_UA 3 роки тому +1

    Nice done!

  • @backistall3452
    @backistall3452 3 роки тому

    Great video. Please upload more videos)

  • @gagandeepsingh2925
    @gagandeepsingh2925 3 роки тому +1

    Nice video

  • @idontknow-wl6su
    @idontknow-wl6su 3 місяці тому

    FINALLY,!!!! i understand this :D, this video helpme a lot, thanks : )

  • @softwareinterviews2713
    @softwareinterviews2713 3 роки тому +1

    Amazing videos! Can you make one about Manacher's algorithm on longest palindromic substring?

    • @stablesort
      @stablesort  3 роки тому

      Thanks for the suggestion, I'll look into it!

  • @iliasp4275
    @iliasp4275 4 роки тому +1

    very nice! thank you!

  • @egortkachenko
    @egortkachenko 4 роки тому +1

    Very good vieo, thank you for that simple explanation!

    • @stablesort
      @stablesort  4 роки тому

      Спасибо за комплимент!

  • @anonk811
    @anonk811 3 роки тому

    How can we keep a linked list of actually LIC (or any ds) with the simpler solution (7-8 line solution where we just have a piles[])? How to capture the left pile element when a new pile is created? Also, will it ot not break when the first element of a new pile is pointing to the top (at that time) of the left pile and then this current pile has another element later on top which was pointed from yet another new pile top element on its left? e.g. [10, 5] [8] here 8 → 5, but then later the top elements of these two piles are [5] [8] and 6 comes so it becomes [5] [8, 6] i.e [5] [6] as only top element is visible and then 7 comes, so we have third pile now [5] [6] [7] which is pointing to 7→ 6? Do we do linked list insertion now?

    • @stablesort
      @stablesort  3 роки тому +1

      Thanks for your question. As each card is placed on some pile, you also store a pointer from that card to whatever is the current top most card of the pile immediately on the left. Later on, there may be more cards added to both of those piles but the original pointer is still liking up the original two cards. The source code of a fully functional Java implementation is linked in the description, but here it is again:
      bitbucket.org/StableSort/play/src/master/src/com/stablesort/challenge/LongestIncreasingSubsequence.java
      I hope this helps!

  • @jacobkurien
    @jacobkurien 3 роки тому +1

    good one

  • @vinayjangra1401
    @vinayjangra1401 Рік тому

    2:45 what if the cards are [100, 10, 5.....] , then choosing left most will not allow the wide range of cards to place?? what to do in that case

  • @vishalsingh118
    @vishalsingh118 4 роки тому +2

    perfectttttt.........

    • @stablesort
      @stablesort  4 роки тому +1

      I am glad to know that the video helped!

  • @amogchandrashekar8159
    @amogchandrashekar8159 3 роки тому +1

    Subscribed!

  • @dashdoom8452
    @dashdoom8452 3 місяці тому

    You are the goat

  • @SergeyIvanov1337
    @SergeyIvanov1337 Рік тому

    good channel

  • @bkarpov
    @bkarpov 4 роки тому +1

    Спасибо

  • @jaskaranbindra9939
    @jaskaranbindra9939 4 роки тому +1

    If you think you didn't understand the video simply replay.