Form 3 for DP | Multi-Sequence DP | Day 3 Part 2 | Dynamic Programming workshop | Vivek Gupta

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

КОМЕНТАРІ • 46

  • @devansh3686
    @devansh3686 Місяць тому

    loved this workshop

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

    Another amazing day of dp

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

    Thank you for the video👍

  • @JP-en3cm
    @JP-en3cm 2 роки тому

    Excellent

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

    No doubts for this video but Just letting you know ki you already know what's the probability of doubts of a beginner level coder. Like when you were explaining Form 3 at 10:44 even I was wondering what if there are more than two strings and its starts with the same element as of string A but you explained that too by the end of the video. Tysm😻

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

    Enjoyed a lot ♥

  • @piyushsingh894
    @piyushsingh894 Місяць тому

    We can further optimize it like if (a[i]==b[j]) is true then there is no need to check for rec(a, b, i + 1, j) and rec(a, b, i, j + 1) as making unnecessary recursive calls increases computation.
    if(a[i]==b[j])
    {
    ans=max(ans,1+rec(a,b,i+1,j+1));
    }
    else{
    ans=max(ans,rec(a,b,i+1,j));
    ans=max(ans,rec(a,b,i,j+1));
    }

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

    I'm kind of finding it difficult to exactly think how this structure of code can exactly be applied to solve longest common substring instead of subsequence. As in that case, we still have the same choices to either take both , or discard any one of the two strings. But the only difference over there is that the indexes chosen have to be consecutive. So do we need to take prev_i and prev_j as two another states or how exactly do we have to proceed in that case ?

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

      whenevr s[i]!=SS[j] , make curr_max_length=0;

  • @Ramu9119
    @Ramu9119 5 місяців тому

    Nice Video Vivek

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

    Self note: if we are given multiple sequence nd we have to match them somehow or get ans from a(0.....n) and b(4.....m) and c(2.....q) we will use form 3 - multi sequence dp

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

    Understood 😃

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

    Thank you sir

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

    great class.
    understood.

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

    🔥 thanks ☕☕

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

    Yup present

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

    please do a session on common leetcode problem using these forms

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

    discuss more patterns that we can solve using only these forms.

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

    🔥🔥🔥

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

    in which lecture you have explained calculation of Time Complexity??

    • @SatyamKumar-yz5gk
      @SatyamKumar-yz5gk 2 роки тому +1

      He explained it in Day 2 part 2.

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

      @@SatyamKumar-yz5gk ok will watch it,Thenks :D..

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

    Line 21 wale code m ....jo if() statement hai usko line 19 se upar hona chahiye n????

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

      Not necessary.. which timestamp?

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

      @@vivekgupta3484 17:37 wale m .....agar wo check nahi karega to rec(i+1 ,j) x string me end tak jaega nd phir rec(i,j+1) y string m end tak ......and after check karega ....this is the confusing.please help sir

  • @adityaghosh9955
    @adityaghosh9955 4 місяці тому

    The following code exceeds time limit on leetcode. What to do?

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

    Will there be any more videos today??

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

    Can prefix sum Dp be implemented in recursive solution? Like I just know how to do it with iterative approach but I am not too comfortable with iterative dp.

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 роки тому

    Can we do interleaving string in live using form 3.

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

    what if there are more than 3 strings, do we need to write cases for each like if 4 strings then will take 4 index and do the same stuff?

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

      Yes. If here are N, then maybe you can keep a vector and that would be much more efficient.

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

    🛐

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

    👍

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 роки тому

    In case of n strings how we will do it as it won’t be wise to have n states 🤔

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

    bhaiya what about the iterative form? how to write that?

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

      we learn that in next days

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

      @@vivekgupta3484 bhaiya you mean in lecture 24?

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

      i meant from day 5 onwards we see how to code in iterative way

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

      @@vivekgupta3484 thanks bhaiya

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

    when i submit the code on gfg it is giving tle

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

    Tried to solve the longest common substring question using this form and the previous form(2 and 3).The meaning for dp[I][j] -> what is the longest common substring between string a[0....i] and string b[0....j]. The transitions include if the character matches at a[i] and b[j] then we search for the same in string a[0....i-1] and string b[0....j-1] else the return value of the current state is 0.Further on we call the recursive function upon rec(i-1,j) and rec(i,j-1)....Could you please help in coding up this solution since I tried but could not succeed....None the less amazing content once again!

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

    attendance +1

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

    👍