Longest Increasing Subsequence | Dynamic Programming

Sdílet
Vložit
  • čas přidán 8. 09. 2020
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we explain about subsequences and discuss the Longest Increasing Subsequence problem in dynamic programming, In this problem,
    1. You are given a number n, representing the number of elements.
    2. You are given n numbers, representing the contents of array of length n.
    3. You are required to print the length of longest increasing subsequence of array.
    To submit this question, click here: www.pepcoding.com/resources/d...
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    Have a look at our result: www.pepcoding.com/placements
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education

Komentáře • 196

  • @carpediem5112
    @carpediem5112 Před 3 lety +81

    I have never commented on any channel but you are the mentor I was looking for years. I have watched many youtube videos on dp, no one explained the 'WHY'. Great explanation, great content...specially the way of teaching. JABRA FAN BANGYA DADA .

  • @sandeepgampa4118
    @sandeepgampa4118 Před rokem

    I have watched several videos but have never seen such a detailed explanation. Hats off to you bro. Thanks a lot.

  • @debbh274
    @debbh274 Před 2 lety

    Seriously, you guys have proved, that Indians have so much talent and some of the best explanations... Sincere thanks for the fantastic videos.

  • @kasifreza8971
    @kasifreza8971 Před 3 lety +3

    I am watching tutorials from last couple of years, you are one of the best teacher. Amazing

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

  • @anchalpandey2787
    @anchalpandey2787 Před 3 lety +23

    The best lecture series available on youtube for DP

    • @Pepcoding
      @Pepcoding  Před 3 lety +2

      Thankyou beta,
      I am glad you liked it. I also hope that you are watching till end.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @abhinavshukla5164
    @abhinavshukla5164 Před 2 lety

    Hands down all other channels were jzt telling the algo but not the intimation and the reason but u xplained it well 🔥

  • @gauravjha7136
    @gauravjha7136 Před 3 lety +3

    the best explanation i got for this problem. Sir i have learnt a lot from you. You are really a bliss

  • @adityaojha2701
    @adityaojha2701 Před 3 lety +2

    Wow!! What else can be better than this explanation.

  • @ayushiagarwal6996
    @ayushiagarwal6996 Před 3 lety +1

    I tried to look for the answer in many other channels but no one explained the way you did from scratch. Thank you sir it's really amazing

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @Codey_1
    @Codey_1 Před 2 lety

    sir jis tarah se ap samjhate ho hr problem asan lgti h
    yeh question pehli bar itna acche se samajh aya h

  • @abhisheksharma1031
    @abhisheksharma1031 Před 3 lety +2

    Very nice and crystal clear explanation. I loved the concept of answering the 'what' and 'how' and then answering the 'why' of the problem. Loved it!!

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta!
      I am glad you liked it. It's all with the effort and hardwork from our brilliant mentors(Subhesh sir and all the other teacher of pepcoding). If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @444not
    @444not Před 3 lety

    Thank you ! very happy I found your channel.

  • @KickNationReal
    @KickNationReal Před 2 lety

    Just amazing, you have helped me a lot in clarifying my dp concepts.

  • @omegzable
    @omegzable Před 3 lety

    this is by far the best explanation according to me

  • @mdtokitahmid2970
    @mdtokitahmid2970 Před 2 lety

    One of the best teaching style!! Thanks a lot. From Bangladesh :D

  • @sarangr8624
    @sarangr8624 Před 3 lety +6

    Your channel deserves Millions of followers 👍

    • @Pepcoding
      @Pepcoding  Před 3 lety +2

      Maybe one day. Thank you so much keep motivating, keep learning and keep loving Pepcoding😊

  • @SonuKhan-mp2yn
    @SonuKhan-mp2yn Před rokem +1

    million dollar content. Thank you so much sir.

  • @rahulbhatia3075
    @rahulbhatia3075 Před 3 lety +4

    Thank you sir for posting amazing content for free 😀😀. I am sure many students will get benefit from these videos.

  • @adeshgangwar3555
    @adeshgangwar3555 Před rokem

    explained it very well sir.... aapka style hi alg hai smjane ke.

  • @adarshshrivastava6326
    @adarshshrivastava6326 Před 3 lety

    Kya hi gazab padhate ho sir aap! THANK YOU

  • @saisriangajala8399
    @saisriangajala8399 Před 2 lety

    you deserve million subscribers ... lots of love❤️❤️❤️

  • @UntamedRogueMavrick
    @UntamedRogueMavrick Před rokem

    काफी स्पस्ट व्यवरण मित्र।

  • @_HarshitSharma
    @_HarshitSharma Před 2 lety +2

    I'm literally amazed sir ji! I watched this video at almost 3:50 am in the middle of the night when I was struggling to sleep, and I still can't believe I actually understood the whole approach and concept of this popular classical dp problem. Thankyou so much Sir ♥️ @pepcoding you simply rock! Can't wait to mark the submission for this question on your platform in the morning ⚡⚡

    • @Pepcoding
      @Pepcoding  Před 2 lety

      That really means a lot. For better experience and well organised content sign up on nados.io and start learning.

  • @FindARandom
    @FindARandom Před rokem

    Thanks brother lots of love

  • @autismo1969
    @autismo1969 Před 2 lety +1

    Fantastic explanation sir👏👏 thanks a lot

  • @aroo1377
    @aroo1377 Před 2 lety

    Sir Thank you very much.. Your explanation is the best.

  • @madIndianHindu
    @madIndianHindu Před 2 lety

    Great Explanation sir! i will not believe if anyone says that he can explain this question better than you, keep going sir, Awesome !!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      for better experience why don't you use this same content on nados.pepcoding.com?

  • @saranggakhar7932
    @saranggakhar7932 Před rokem

    thankyou sir for the amazing tutorials

  • @vrindasharma4035
    @vrindasharma4035 Před rokem

    Sumeet sir, maza aagya!

  • @rehanakhter4813
    @rehanakhter4813 Před 3 lety

    best content for lis.
    superb explained!!!

  • @lakanavarapunagamanikantaa7299

    really brother i watched like 7 videos to understand what u said it was nice

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thank you so much Bhai keep motivating, keep learning and keep loving Pepcoding😊

  • @mansigoyal4796
    @mansigoyal4796 Před 3 lety

    You are guru of coding ...Best teacher ever

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit

  • @ayush.choudhary
    @ayush.choudhary Před 2 lety +1

    Great Explanation...👍👍

  • @vinayak186f3
    @vinayak186f3 Před 3 lety

    Awesome explanation sirji ❤️

  • @obamaengineer4806
    @obamaengineer4806 Před 2 lety

    mindblowing solution no doubt

  • @uditgarg6325
    @uditgarg6325 Před 2 lety

    Thank you Sumeet sir

  • @aryanyadav3926
    @aryanyadav3926 Před 2 lety +1

    Superb explanation sir!

  • @namanjain9922
    @namanjain9922 Před 3 lety +1

    Thank your sir for such logical explanation Glad I reached to your videos!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @abhirupbarua8361
    @abhirupbarua8361 Před rokem +1

    Thank You sir !

  • @AnkitSingh-zj2uc
    @AnkitSingh-zj2uc Před 3 lety +1

    So finally you added TC
    Thanks sir

  • @prakharpathak9212
    @prakharpathak9212 Před 3 lety

    Great explanation 👍

  • @GopalKumar-py2cf
    @GopalKumar-py2cf Před rokem

    awesome explanation sir

  • @AmanSharma-vb5jl
    @AmanSharma-vb5jl Před 2 lety

    you are simply awesome

  • @proghead00
    @proghead00 Před 3 lety +1

    Amazing explanation. Thank you.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked the content and thankyou for appreciating😊
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @prashantranpura7412
    @prashantranpura7412 Před 3 lety

    Best explanation 👍

  • @hasbealam
    @hasbealam Před rokem

    Thank you, sir

  • @jagdishsahoo8232
    @jagdishsahoo8232 Před 3 lety

    Explanation is just awesome...Thank you sir.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      You are most welcome and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @ranavij
    @ranavij Před 3 lety +1

    Thanks for the explanation really helpful.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @Impromptu21
    @Impromptu21 Před 3 lety

    One thing that makes u different and beautiful is thinking about what ..why and how of problem.lots of love sir ji

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @GyaanGrave
    @GyaanGrave Před rokem

    Dear Sumeet, may you attain eternal peace, longevity, health and vitality.

  • @heal4066
    @heal4066 Před 2 lety

    Brilliant!!

  • @hymnish_you
    @hymnish_you Před 3 lety

    Thankyou Sir!

  • @HarshKumar-nh6be
    @HarshKumar-nh6be Před 3 lety +1

    Great teaching! :)

  • @vikashgupta3305
    @vikashgupta3305 Před 3 lety +1

    Again hatsoff to you sir, your explanation is so raw , so down to earth, no rocket science i m literally now a very big fan of your explanation . Yesterday i watched kadanes algorithms u nailed it today i saw this video u again blown my mind , your concept of What Why and How is very much helpfull. Knowledge which u deliver to us in such a systematic way is awesome it got smoothly into my head .
    I m realising it was just hype about DP after seeing ur explanation i m too much Nischint. Thankx a lot sir.
    Sir please explain this Q in NLogN also, I m now habituated to your way of explanation so now no videos are suiting my slow brain.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta, for such kind words.
      I am glad you liked it. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

    • @vikashgupta3305
      @vikashgupta3305 Před 3 lety

      Sure sir.

    • @mayankverma3690
      @mayankverma3690 Před 3 lety

      Same i love his videos!

  • @Bobby-mf6fw
    @Bobby-mf6fw Před 3 lety

    Sir fabolus 🔥🔥go ahead...🏫

    • @Pepcoding
      @Pepcoding  Před 3 lety

      If you like my efforts, I request a review
      g.page/Pepcoding/review?rc

  • @SANCHITJAIN_
    @SANCHITJAIN_ Před rokem

    nice explanation

  • @bandarurakesh1614
    @bandarurakesh1614 Před 2 lety

    Best Explanation!!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      You can get more content like this on nados.pepcoding.com

  • @Ballistic_Bytes
    @Ballistic_Bytes Před 2 lety

    Brilliant explaination

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you love the explanation.
      For better experience and well organised content sign up on nados.io and don't forget to follow us on Instagram instagram.com/pepcoding/

  • @condemned8916
    @condemned8916 Před 2 lety

    Great way of explaining. This way complex problems become very simple.

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad it was helpful!
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

    • @condemned8916
      @condemned8916 Před 2 lety

      @@Pepcoding Can you please provide the solution for this problem for n(log n) approach

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better insight, visit nados.pepcoding.com, , post your doubts, community will help you out there.

  • @sonalisaxena22
    @sonalisaxena22 Před 3 lety

    well explained sir! Thankyou

  • @NDBROTHERS
    @NDBROTHERS Před 3 lety +2

    can be done in O(N log N) if we want to find only the length
    using a temp array and a lower bound
    1. push the first element in the array
    2. now loop(1,N) if arr.back() just push curr_element to the arr
    else find lower bound of curr_element from arr and replace with curr_element
    hopefully i make sense :|

    • @Pepcoding
      @Pepcoding  Před 3 lety +3

      hanji, have been mentioned in the video ki iska better approach hai isse.

  • @yashkushwaha8492
    @yashkushwaha8492 Před 2 lety

    Sirji ek baar mein samajh aa gya recursion/memoization se tle aa rha tha, tabulation sahi hai!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad to hear that for better experience and well organised content visit - nados.io

    • @vinayjangra1401
      @vinayjangra1401 Před rokem

      can you pls share recursive/ memoized solution for this problem. 🙏🙏

  • @peaceandlov
    @peaceandlov Před 3 lety +2

    LEGEND!!

  • @nirajgusain4597
    @nirajgusain4597 Před 2 lety

    jab bure din aate h toh, Input lena pdhta h - sumeet malik(sept 9,2020)

  • @sauravkumar188
    @sauravkumar188 Před 3 lety

    Thanks for sharing these content sir!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad you like them! and If you like the content could you post something on LinkedIn about us? This will help us in reaching out to more people and help a lot of other students as well
      Something like this
      Sumeet Malik from Pepcoding is making all his content freely available to the community
      You can check it out here - www.pepcoding.com/resources
      /
      Also, this is the youtube channel - czcams.com/users/Pepcodingplaylists?view_as=subscriber

    • @sauravkumar188
      @sauravkumar188 Před 3 lety

      @@Pepcoding definitely

  • @shubhamdeshmukh9287
    @shubhamdeshmukh9287 Před 3 lety

    witness the awesomeness

  • @nuamaaniqbal6373
    @nuamaaniqbal6373 Před 2 lety

    thank you sir.

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Hope you love the explanation, for better experience and well organised content sign up on nados.io and start learning.

  • @harshitasingh963
    @harshitasingh963 Před 3 lety

    Brilliant

  • @444not
    @444not Před 3 lety

    Maza aa Gaya dost. What’s the story behind pepcoding?

  • @RishabhJain-hr6sz
    @RishabhJain-hr6sz Před 2 lety

    kuch alag he baat hai!!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @divyrajsingh8711
    @divyrajsingh8711 Před 3 lety

    sir can hashmap be used key will be value in array and value will be a integer array if while traversing greater is found pus it into arraylist and return the size of maximum length arraylist

  • @guneettalwar2630
    @guneettalwar2630 Před 3 lety +1

    Great explanation again!!! Also sir, DP has only been taught through questions? Or is there theory about it too, if yes where can i find it.

    • @Pepcoding
      @Pepcoding  Před 3 lety +3

      Thankyou beta!
      I am glad you liked it.
      Will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms)
      Hanji, It is taught through questions only, basically jha bhi overlapping subproblem dikhe apko, vha dp lgate h hum.

  • @saketkumarsinha6750
    @saketkumarsinha6750 Před 3 lety

    Adbhut

  • @saileesalgaonkar2878
    @saileesalgaonkar2878 Před 3 lety

    Great explanation! Can you please explain nlogn approach also!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Buddy may b we will cover this in level-3 playlist.

  • @saliq0097
    @saliq0097 Před 2 lety

    @sir where to find your video for nlogn solution for this problem ?

  • @ShubhamRaj-tm9ui
    @ShubhamRaj-tm9ui Před 3 lety +5

    sir,please do upload video on this topic using recursion with memorization.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, recursion main itne question ho gye h, ki bacho ki thinking capability bn jaye ki vo naye question ki recursion khud se soch paye, issliye dynamic programming ki series main directly dp solution krvaya gya h. But if you are facing some problem or for clearing your doubts, you can join our community on telegram - t.me/pepcoding

    • @mickyman753
      @mickyman753 Před 2 lety

      @@Pepcoding sir recursion ki playlist main mostly recursion on the way wale questions hai ,kuch faith wale thode add kr dijiye sir jisse dp mai bhi memoise krne mai problem na ho please

  • @AyushRaj-pm1dz
    @AyushRaj-pm1dz Před 2 lety

    Can anyone give the link for the NLOGN approach video by sir.....

  • @tanishkumar6682
    @tanishkumar6682 Před rokem

    understood

  • @manishkumarsingh4631
    @manishkumarsingh4631 Před 2 lety

    8/79 Done

  • @ayushbhardwaj3296
    @ayushbhardwaj3296 Před 3 lety +2

    Great Explanation .....Deserves ......Integer.MAX_VALUE (no. of likes)

  • @amansahore3198
    @amansahore3198 Před 3 lety +2

    Can this question be done with lcs of original array with sorted array? I am facing some problems if there are repeated items present in the array.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

  • @samridhiagrawal5851
    @samridhiagrawal5851 Před 3 lety

    Nice lecture

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @NaushadAli-uq1ss
    @NaushadAli-uq1ss Před 2 lety

    W h w concept is goldust

  • @bhavnamishra0327
    @bhavnamishra0327 Před 3 lety

    sir leetcode pe ek test case pass nhi ho raha jab sare elements same hai array mei like(4,4,4,4) to ans one hona chahiye but 4 aa raha hai..

  • @payalsagar1808
    @payalsagar1808 Před 3 lety

    Thankyou

    • @Pepcoding
      @Pepcoding  Před 3 lety

      You are welcome and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @jatinkumar4410
    @jatinkumar4410 Před 3 lety

    Very nice explanation...

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta,
      Glad to know that you liked the content and thank you for appreciating. If you like our efforts, will you like to write a review about us here - g.page/Pepcoding/review?rc

    • @jatinkumar4410
      @jatinkumar4410 Před 3 lety

      @@Pepcoding sure sir

  • @pranshulkharniwal8146
    @pranshulkharniwal8146 Před 2 lety

    majha aa gya

  • @Nikhil-qd9up
    @Nikhil-qd9up Před 3 lety

    Great explaination sir 🔥, sir can u please explain the binary search wala method of the above problem

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou buddy!
      I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

  • @entertainshala
    @entertainshala Před 3 lety +4

    Sir could you please teach for the c and c++ background students also..i.e., as you are using int and Integer .. those are different for java nd c++..so y could not you use -1 insted of null..?

    • @chirags2711
      @chirags2711 Před rokem

      you can use min value, and add a check at end, if it is still equal to min value. -1 won't work if array has negative numbers.

  • @sankalpmehadia9252
    @sankalpmehadia9252 Před 3 lety +4

    Sir this question needs to be solved in O(nlog(n)) we need to optimise further

  • @coders9819
    @coders9819 Před 3 lety

    Best video

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @manpreetsinghrana7751

    Sumeet Sir is the OG

  • @paraskumar693
    @paraskumar693 Před 2 lety

    how can we do "what" and "how" before "why" while solving it on our own.

  • @user-wd8tg9mr1h
    @user-wd8tg9mr1h Před 2 lety

    Sir, how to print the longest increasing sequence?

  • @uditgarg6325
    @uditgarg6325 Před 2 lety

    Sir, what is your name? I am a BIG FAN of yours.

  • @ranavij
    @ranavij Před 3 lety +1

    Hi sir it would be of great help ,if you would help us with notes such as algorithm ,although it is quite clear from the code ,but looking back after some time say 6 months back, sometimes things vanish ,so it's helpful to take a basic key important note .Getting them would be of help

  • @jatinbhatoya8420
    @jatinbhatoya8420 Před 3 lety

    SIR iski nlogn wali approach ki bhi video bna do pls.

  • @md.monjormorshed2046
    @md.monjormorshed2046 Před 2 lety

    Is it a Dynamic Programing approach?

  • @tushargoel5522
    @tushargoel5522 Před 2 lety

    I think this algorithm is called the Patience algorithm. Similar to Solitaire game.

  • @vrindasharma4035
    @vrindasharma4035 Před rokem

    24:58, we can write int omax=1; at line number 16.

    • @vinayjangra1401
      @vinayjangra1401 Před rokem

      what if input array length is itself 0 :))

    • @vrindasharma4035
      @vrindasharma4035 Před rokem

      @@vinayjangra1401 leetcode problem number 300, please do check the constraints regarding the length of an array!