Longest Increasing Subsequence (LeetCode 300) | Detailed solution with animations and diagrams

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 21. 07. 2024
  • Actual problem on LeetCode: leetcode.com/problems/longest...
    Chapters:
    00:00 - Intro
    01:19 - Problem Statement
    05:27 - Brute Force & Recursion
    09:25 - Dynamic Programming
    19:11 - Dry-run of Code
    22:03 - Finding the longest increasing subsequence
    26:53 - Final Thoughts
    📚 Links to topics I talk about in the video:
    Dynamic Programming Paradigm:
    Recursion: ‱ Recursion paradigms wi...
    Other problems on Dynamic Programming: ‱ Linked Lists
    📘 A text based explanation is available at: studyalgorithms.com
    Code on Github: github.com/nikoo28/java-solut...
    Test-cases on Github: github.com/nikoo28/java-solut...
    📖 Reference Books:
    Starting Learn to Code: amzn.to/3sJm8Wl
    Favorite book to understand algorithms: amzn.to/4848xJH
    Favorite book for data structures: amzn.to/3P96YBv
    Get started for interview preparation: amzn.to/44Nn5du
    🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
    đŸŽ„ My Recording Gear:
    Recording Light: amzn.to/3PdsViT
    Microphone: amzn.to/3Exv83x
    Recording Camera: amzn.to/3PwyN8e
    Tablet to sketch and draw: amzn.to/3ZdKVy7
    Sketching Tool: amzn.to/45XJEgY
    Laptop to edit videos: amzn.to/460ofDu
    đŸ’» Get Social đŸ’»
    Follow on Facebook at: / studyalgos
    Subscribe to RSS feeds: studyalgorithms.com/feed/
    Join fan mail: eepurl.com/g9Dadv
    #leetcode #programming #interview

Komentáƙe • 56

  • @vibhutikumar441
    @vibhutikumar441 Pƙed 6 měsĂ­ci +9

    one of the underrated channels you got 1 more subscriber your explanations are very satisfactory

    • @nikoo28
      @nikoo28  Pƙed 6 měsĂ­ci

      Welcome aboard!

  • @ashishchoudhary1664
    @ashishchoudhary1664 Pƙed 2 měsĂ­ci +1

    When I'm not able to understand Neetcode solutions, I come to this channel. It feels like you take time to explain in detail and cover small details and use a lot of test cases. Using multiple test cases helps understand the problem better. I subscribed long back. keep up the good work.

  • @a3rdtierguy864
    @a3rdtierguy864 Pƙed 6 měsĂ­ci +2

    what a great approach definitely everybody should watch i donot have words for your explanation just wow

  • @sikkjim4846
    @sikkjim4846 Pƙed 6 měsĂ­ci

    I just wanna say thank you so much, you are the best programming instructor on youtube, no doubt!

  • @akashskumar6389
    @akashskumar6389 Pƙed 13 dny

    i usually used to check videos with shortest time, but since I started watching your approaches I ended up looking if your videos are there for the questions on priority

  • @surabhiagnihotri7561
    @surabhiagnihotri7561 Pƙed 6 měsĂ­ci +1

    loved the explanation, super easy you made it! thankyouuu!

  • @dianayao1677
    @dianayao1677 Pƙed 6 měsĂ­ci

    Dry run part is the best , you are the only one doing this , I can finally connect the code with the logic. Thank you !!!!

    • @nikoo28
      @nikoo28  Pƙed 5 měsĂ­ci

      so happy you feel that way

  • @Kripa-bg5tk
    @Kripa-bg5tk Pƙed 3 měsĂ­ci

    You made the problem seem so easy! Thank you!

  • @peddibharath7016
    @peddibharath7016 Pƙed 6 měsĂ­ci +3

    Great video. Clearly understood

  • @user-xi7lg3em8i
    @user-xi7lg3em8i Pƙed 4 měsĂ­ci

    Really clear, keep up the good work!

  • @abdulrehmanamer4252
    @abdulrehmanamer4252 Pƙed 4 měsĂ­ci

    You have explained it way better.
    An Impressive Guidance to this problem...

  • @generalknow_ledge
    @generalknow_ledge Pƙed 6 měsĂ­ci +2

    Amazing brother I understand the problem and the solution too. THANKS TO YOU ❀

    • @nikoo28
      @nikoo28  Pƙed 6 měsĂ­ci

      Most welcome 😊

  • @shristisrivastava7054
    @shristisrivastava7054 Pƙed 15 dny

    Amazing explanation. Thank you for making this video

  • @yashpawar2693
    @yashpawar2693 Pƙed 6 měsĂ­ci

    Thanks bro đŸ”„đŸ”„đŸ™Œ found out the best video after lots of searching

    • @nikoo28
      @nikoo28  Pƙed 6 měsĂ­ci

      Your search ends here 😄

  • @frankacquah5416
    @frankacquah5416 Pƙed 6 měsĂ­ci

    Thank you man for this. Nice explanation

  • @yomamasofat413
    @yomamasofat413 Pƙed měsĂ­cem

    great video I like the step by step instructions

  • @rambhaktuchihaobito7987
    @rambhaktuchihaobito7987 Pƙed 7 měsĂ­ci +1

    wow ...........great explanation :) thank u sir 💟

  • @enriquegrageda
    @enriquegrageda Pƙed 5 měsĂ­ci

    I feel like my brain does push ups when i learn from you, thanks bro!

  • @aman_rockstar31
    @aman_rockstar31 Pƙed 6 měsĂ­ci +1

    best explanation u make dp easy with ur explanation thanku

  • @a-talks4197
    @a-talks4197 Pƙed 3 měsĂ­ci

    Hats off to you what an amazing explanation :)

    • @nikoo28
      @nikoo28  Pƙed 3 měsĂ­ci

      Thanks a lot 😊

  • @sriyanandakuchimanchi4042
    @sriyanandakuchimanchi4042 Pƙed měsĂ­cem

    i was able to figure out this solution myself ,😁😁😁😁,,,just took a little help for code tho...thanks nikhil sir ur teaching is goated

  • @a3rdtierguy864
    @a3rdtierguy864 Pƙed 6 měsĂ­ci +2

    WE WANT more series on dp .

  • @kavyakooks5305
    @kavyakooks5305 Pƙed 5 měsĂ­ci

    Great Explanation!!

    • @nikoo28
      @nikoo28  Pƙed 5 měsĂ­ci

      Glad it was helpful!

  • @yashyadav7017
    @yashyadav7017 Pƙed měsĂ­cem

    muah
.muah
muah
chummi
chummi
chummi
.God bless u bhai
top notch teacher
.

  • @dsenthilkumar3751
    @dsenthilkumar3751 Pƙed 8 měsĂ­ci +1

    you are really awesome â€â€đŸ”„ thank you for Eever

  • @chris5000r
    @chris5000r Pƙed 6 měsĂ­ci

    I find your videos very helpful in preparation for my upcoming interview

  • @mehedihasannnnn
    @mehedihasannnnn Pƙed 8 měsĂ­ci

    Sir you are awesome. Thank you for this video ❀❀

    • @nikoo28
      @nikoo28  Pƙed 7 měsĂ­ci

      Most welcome 😊

  • @thirumalainambi6068
    @thirumalainambi6068 Pƙed 6 měsĂ­ci

    tooooo awesome man

  • @abhigoku2022
    @abhigoku2022 Pƙed 5 měsĂ­ci

    Hi Sir,
    Eveytime I am searching for a leeetcode problem, I add your name in the suffix hoping you have done a video on it. I have understood each and every video that I have watched. Please do solve all the problems, that will be very helpful for people like me.

  • @debashismahapatra5961
    @debashismahapatra5961 Pƙed 2 měsĂ­ci

    Shouldn't it be "return maxIndex + 1" ? Can you check ?

  • @fjhvfjhv143
    @fjhvfjhv143 Pƙed 8 měsĂ­ci

    Which drawing app you use to write this all on iPad? and btw great explaination and please do not forgot to give answer
    👍

    • @nikoo28
      @nikoo28  Pƙed 7 měsĂ­ci

      that is GoodNotes 6.

  • @rafaelperez7029
    @rafaelperez7029 Pƙed 4 měsĂ­ci

    Sorry, I have a quick question, What do you use to draw your diagramans?

    • @nikoo28
      @nikoo28  Pƙed 4 měsĂ­ci

      That will be GoodNotes 6

  • @krishnateja3845
    @krishnateja3845 Pƙed 6 měsĂ­ci

    can you tell me why did you avoid using index 2 while backtracking and finding the longest sequence elements 26:00

    • @nikoo28
      @nikoo28  Pƙed 6 měsĂ­ci

      Did you follow the entire logic of the solution explanation or went straight to the code?

    • @devk5061
      @devk5061 Pƙed 5 měsĂ­ci

      ​@@nikoo28you mentioned to backtrack till zero but why u skipped only 2?

  • @Usseeer_kaizen
    @Usseeer_kaizen Pƙed 4 měsĂ­ci +1

    nice

  • @prashanthshetty8337
    @prashanthshetty8337 Pƙed 3 měsĂ­ci

    @nikhil Could you please explain how this solution works? I found this on leet code
    func lengthOfLIS(nums []int) int {
    arr := make([]int, 0)
    for _, num := range nums {
    if len(arr) == 0 || arr[len(arr)-1] < num {
    arr = append(arr, num)
    continue
    }
    // binary search arr find minimum element greater or equal with num
    l, r := 0, len(arr) - 1
    for l

    • @nikoo28
      @nikoo28  Pƙed 2 měsĂ­ci

      Have you tried using a debugger?

  • @umershabir_
    @umershabir_ Pƙed 8 měsĂ­ci

    Dear Nikhil I love you so much! from Pakistan, I would love to know about you personally! like what actually you do?

    • @nikoo28
      @nikoo28  Pƙed 7 měsĂ­ci

      A software developer.

  • @user-yd6bw3rz2f
    @user-yd6bw3rz2f Pƙed 4 měsĂ­ci

    bro please correct it O(n^2) is better than O(2^n) , that brute force is the better approach compared to recursion

  • @kolawoleabdulrahman
    @kolawoleabdulrahman Pƙed 8 měsĂ­ci +3

    Nikhil Lohia > Neetcode.

  • @cautioni
    @cautioni Pƙed 4 měsĂ­ci +1

    this solution isn't the most optimised one, atleast according to GFG. it's giving TLE, I really like how you explain, i would request you to make a new video with an accepted solution.

  • @bharathkumar8807
    @bharathkumar8807 Pƙed měsĂ­cem

    o