Longest Common Substring Dynamic Programming

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

КОМЕНТАРІ • 82

  • @VKBMath
    @VKBMath 3 роки тому +32

    This type of content is free unbelievable
    Love you Sumeet sir what a teacher ❤️❤️❤️❤️❤️❤️

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

      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.

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

    Aaj real meaning smj m aaya,baki log to bus dp bharna batate h.
    👍👍.
    Thank you sir for these free content

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

    No one gave this kind of insight of the problem , the WHY portion explained is excellent.
    Thanks Sir for such a great content.

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

    I solved this problem without even watching this video, using the techniques brother Sumeet taught in earlier problems like Longest palindroming substring, longest common subsequence etc.
    That proves how extremely good he is at teaching these staffs.
    Keep it up bro.

  • @samarthjain5295
    @samarthjain5295 3 роки тому +6

    This video deserves a like tbh, I have seen so many videos on this question but this is the only video saying that why it is happening .Thank you

  • @abhinavagrawal6148
    @abhinavagrawal6148 3 роки тому +7

    The way he explains agar koi interview me explain kre to interviewer wahi fan ho jaye.

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

    When asked how some tabulation solution works very few people know what's happening inside it, you are the one who knows inside-out of it, thanks a lot for sharing!

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

    There are only 2 words that come to my mind!! ekdum jhakaas!!!! I had seen 3 videos till now for this problem and this is the first video I understood.

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

    This is by far the most amazing explanation to this problem. Hats off!

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

    This is the most underrated channel for programming on youtube

  • @Ali-ok8yn
    @Ali-ok8yn 3 роки тому +3

    Best explanation for this question on the internet. DP solutions are always easy but the important part is how you reached that solution and you have explained that really well.

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

    Why u did?
    J

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

    This channel is a life saver

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

    i really impressed by your explanation.
    thanks man for this.

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

      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 )

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

    All time GOAT, Summet Sir! 🙏

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

    THE BEST EXPLANATION !!!!!!

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

      Thank you! Cheers!
      For better experience and precisely arranged content visit on nados.pepcoding.com
      Don't forget to follow us on Instagram instagram.com/pepcoding/

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

    This question can be done in other way also , i.e, we can also evaluate longest common substring by comparing all suffixes of s1 with all suffixes of s2 and find the longest common prefix .

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

    Excellent explaination

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

    Good Content as usual .

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

    super explained 💥💥💥💥💥💥💥💥

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

    nice explanation sir...... akdm clear ho gya.😊😊😊😊

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

      Bhot he bdiya, aise he lge rho aur bdte rho😊🙏

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

    Woah❤
    isse kehte h explaination🙌, this was amazing!

  • @AnandKumar-kz3ls
    @AnandKumar-kz3ls Рік тому

    we can use unordered_set and time complexity can reduced to n^3

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

    Dil se thank you bhai for providing the best content and giving so much time and effort to help us.

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

      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 )

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

    you are really too good sir.......

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

    Some space optimisation :
    class Solution{
    int longestCommonSubstr(String S1, String S2, int n, int m){
    // code here
    int[] prev = new int[S2.length()+1];
    int max = 0;
    for(int i=1;i

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

    Awesome Explanation......Keep making videos

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

    This is the first question of tabular dp I solved without watching the solution

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

    This explanation really gave a feel of the solution. Even better than AV's video

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

      Glad, it was helpful
      For better experience and well organised content sign up on nados.io

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

    ok , whosoever understood this question try thinking out can we do like we are going to store in each cell i , j the LCS between s1(0,i) and s2(0,j). If you figured out the way doing so ,good and if not , why not . comment down below. This will make the understanding of this question crystal clear in your mind. #HAPPYCODING.

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

    One of the best explanation ❤️

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

    Extremely well explanation sir

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

    Great explanation sir

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

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

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

    Sr bina trick jaane ke sbhi prefix ka common suffix ans hai to kaafi mushkil hai complexity km krna.
    agr trick pta ho tbhi hoga km complexity me

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

    Sir,Please make a video on a backtracking solution of longest comon substring.

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

    Sir you are doing a very good job, keep going

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

    sir your explaination is so very good thankyou :)

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

    Wonderful explanation sir🙏🙏🙏🙏

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

    Great explanation. Thank you!

  • @RohitKumar-po5qt
    @RohitKumar-po5qt 3 роки тому

    Brilliant brilliant brilliant !!!!

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

    Wonderful explanation !!

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

    Great Explanation Sir

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

      Thankyou beta 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 )

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

      @@Pepcoding Done Sir

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

    MInd blowing explanation...super

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

      Thank you so much 🙂 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 )

  • @AnkitSingh-xp7mm
    @AnkitSingh-xp7mm 3 роки тому +1

    I was wondering, brute force complexity should be : O(n^2 + m^2 + n.m).
    O(n^2) for prefix of first string.
    O(m^2) for prefix of second string.
    Then Each element of first prefix list gets compared with second prefix list. Hence O(n.m)
    Total Complexity: O(n^2 + m^2 + n.m).
    Please correct me if I am wrong.

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

      n^2 susbtring will be made of first list ,m^2 in another , we will compare everyone of them so n^2*m^2 and each string comapision will take k(max len of both) time , so n^2*m^2*k

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

    understood

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

    38/79 done

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

    Awesome

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

    👍.
    Sir can you plzz guide me regarding scope of placement after doing MTECH from IITB.I mean to say if I do good there will I get good tech companies.

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

    thank you so much sir

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

    Nice explain ❤️❤️

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

    Sir, please make a video on finding common substring of n strings.

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

    Love you

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

    sir leetcode pr problem krra tha hashmap tag ki to usme ye question bhi tha bs array die the string ki jgh
    mne to dp lgaa kr submit krdia
    lekin solution me hashmap se bhi solution tha kch
    ROLLING HASH krke
    kya hota hai sr ye?.

  • @RitikKumar-bk6pj
    @RitikKumar-bk6pj Рік тому

    Sir please tell how we will get the longest common string not their length?

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

    Can anyone guide me if I want to print that substring itself as output then how should I proceed

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

      you can take out the length of substring first and store the i and j index of that column , s.susbtring(i-lcs,i) [this is java substring method] will be our answer

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

    sir ji ye vala question memoization se kardo plz.Iska recursive formula banana bohot mushkil pad raha hai

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

    Can't we just solve it like longest common subsequence and simply store 0 whenever characters are unequal

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

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

  • @SudhanshuKumar-jl8iw
    @SudhanshuKumar-jl8iw 3 роки тому

    I like your explaination ways what?how ?why?it make me think a problem of dp easy ???

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

      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 )

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

    Sir, Can you upload egg drop problem tomorrow?

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

    sir 8 easy questions aane the na dp se pehle ?

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

      bhai aane de jo video daal rhe h saahi h SIR kuch soch ke hi daal rhe honge

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

      @@subhamthakur565 yar sir ne khud hi kaha hai ki pehle 8 easy fir 2 dp isliye pucha

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

    brute complexity will be n(n2 +m2) no n. n2 .m2