Longest Common Subsequence - Leetcode 1143 - Dynamic Programming (Python)

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

КОМЕНТАРІ • 24

  • @GregHogg
    @GregHogg  2 місяці тому +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @SemesterAtSeaHopeful
    @SemesterAtSeaHopeful 5 днів тому

    If the recursive solution and the tabulation have the same time complexity, why is the tabulation so much faster?

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

    Your Videos really help me learn better. Keep uploading man !

    • @GregHogg
      @GregHogg  3 місяці тому +1

      Glad to hear it, will do!

  • @breepoken4218
    @breepoken4218 3 місяці тому +4

    In some ways i find you better than neetcode and other mainstream ones. Underrated and keep uploading!!

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

    This is Great video explaination of the Longest Common Subsequence problem!!BTW what are you using whiteboard drawings ?

    • @GregHogg
      @GregHogg  3 місяці тому +1

      Thank you so much! And it's called Miro :)

  • @shun6284
    @shun6284 18 днів тому +1

    I feel so noob, I can't come up with this solution on my own 😢

  • @GarouNguyen
    @GarouNguyen 2 місяці тому

    bro it top left approach to bottom, why you call this bottom uo

    • @GregHogg
      @GregHogg  2 місяці тому

      Bottom = base cases, top = n (what you desire)

  • @GarouNguyen
    @GarouNguyen 2 місяці тому

    dp i j = dp i-1 j, dp i j-1 can you explain bro, i still don't unserstand

    • @Martinnnnnn-e5s
      @Martinnnnnn-e5s Місяць тому

      if they don't match, you want to go one step backwards, so the current LCS is the same as one step before. Either "i" "j" can go back, so we want the max of them

  • @SwizzRizzBizz
    @SwizzRizzBizz 12 днів тому

    how are supposed to solve questions like these in an interview in a matter of minutes? These companies are just insane

  • @Martinnnnnn-e5s
    @Martinnnnnn-e5s Місяць тому

    I tried to do it like Longest Increasing Subsequence. I see string 2 as an indicator of whether I can add the current letter to the subsequence in string 1. However, there might be repetitive letters and it's all too complicated to make it work so I gave up 😂

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

    you baller...❤

  • @nice-vf4rj
    @nice-vf4rj 3 місяці тому

    Hi Greg can you do string compression? Thanks in advance!!

  • @KandadaiSrinivasaManohar
    @KandadaiSrinivasaManohar 2 місяці тому

    So which is best , top down or bottom up approach?

  • @fantastic-b2m
    @fantastic-b2m 2 місяці тому +1

    am i having some misunderstanding here? the chart that i calculated myself with the same input is
    0 0 0 0 0 0
    0 0 1 1 1 1
    0 1 1 2 2 2
    0 1 1 2 2 2
    0 1 1 2 2 2
    0 1 1 2 3 3
    0 1 1 2 3 4

    • @iancdp9
      @iancdp9 12 днів тому

      That's right, I'm having the same output as you, I believe Greg omitted "a"' from each strings which is why it's still 1 and not 2 in his table.