Coding Interview Question | Minimum Edit Distance | Dynamic Programming with Optimization

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • LeetCode Link - leetcode.com/problems/edit-di...
    InterviewBit Link - www.interviewbit.com/problems...
    Guys, I have made a mistake I in this video. I have forgotten to check the first case at 20:32. The character n is common in both strings. So, the value of M[5][4] will be 2 and final answer will be 3.
    I am not putting down the video since I think explanation is quite clear and it was a genuine mistake. I hope it doesn't trouble you guys. Sorry about the same. Will be more careful from now on! :)
    The video includes following details-
    0:00-0:29 - Question with example
    0:29-1:45 - Which string to convert
    1:45-2:48 - Why dynamic programming
    2:48-3:43 - Visualisation of dp
    3:43-5:43 - Initial conditions
    5:43-9:40 - Algorithm Formation
    9:40-21:06 - Dry run and detailed explanation
    21:06-21:43 - Take any string as source
    21:43-22:00 - Complexities
    22:00-22:40 - Space Optimization
    Please subscribe to my channel - / keertipurswani
    LinkedIn - / keertipurswani
    Instagram - keerti.purs...

Komentáře • 42

  • @theCorporateDiaries
    @theCorporateDiaries Před 4 lety +12

    Great keerti, it's so fulfilling to see real corporate people joining the CZcams and sharing the knowledge, I too am a HR professional and have started a dedicated channel to help people be successful in their career.. I wish you the best dear...

  • @raj_kundalia
    @raj_kundalia Před rokem

    The patience to almost complete the dry run, hat's off to that!

  • @rakhibhatia6613
    @rakhibhatia6613 Před 4 lety +4

    Great job! Keep posting such videos!

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

    Wow..Wow... I have never seen anyone explains DP this clearly, I have seen many other videos but they all say take value from previous, above or diagonal cell, but nobody explained why we need to refer different cells. you are the only one who explains the usage of the previous cells.. you never miss to impress Keerti. I am going to save this video for my DP reference. Keep going

  • @swapnilchhatre5845
    @swapnilchhatre5845 Před 4 lety

    Great explanation.. before coming to this video, I saw some other videos as well.. Only your video had the complete explanation for each step. Thank you so much!

  • @sneha_2005
    @sneha_2005 Před 4 lety +2

    Really helped in visualizing how DP can help in solving this problem. Thanks Keerti!

  • @narenbakshi6301
    @narenbakshi6301 Před 2 lety

    The one line which you use in your videos, "I know it's not easy to understand it now.... once we take an example it will be much more clear" always encourages me to stick to it and it feels as if you know the state of your student/viewer at that point, hats off to your teaching method Keerti and thank you very much!

  • @saisurya153
    @saisurya153 Před 3 lety

    CRYSTAL CLEAR! Thank you :)

  • @kausiknaguri4018
    @kausiknaguri4018 Před 4 lety +1

    Nice explanation... Helps visualizing properly... Keep it up

  • @anurooplsabu5957
    @anurooplsabu5957 Před rokem

    Nice explanation!

  • @engulfing_marubozu
    @engulfing_marubozu Před 2 lety

    simply great

  • @saurabhsingh8996
    @saurabhsingh8996 Před 2 lety

    Great Content...

  • @codinginterviews6029
    @codinginterviews6029 Před 4 lety +1

    great job

  • @arpandwvd
    @arpandwvd Před 4 lety

    Good explanation 👍

  • @ravichandranm3731
    @ravichandranm3731 Před 4 lety +1

    Awesome content and very good in clarity of explanation. Try to reduce the background noise . i loved the content #keerthiPurswani . Cheers

  • @jaggis4914
    @jaggis4914 Před 4 lety +2

    Much better audio! Good job!

  • @thejassampathkumar9688

    thanks for this video. Can you please do a video to explain the coin change problem as well

  • @sathishkumar-dc9ce
    @sathishkumar-dc9ce Před 3 lety

    best ever explanation to this problem ✌️

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

    For the instance where n==n shouldn’t it pick up the value from diagonal up??

  • @ravishasharma1219
    @ravishasharma1219 Před 2 lety

    Hi Keerti, in the If condition it should be str1[i - 1] == str2[j - 1]

  • @codeninja8813
    @codeninja8813 Před 4 lety +4

    In m[5][4], n == n, m[5][4] should be set to m[5-1][4-1] = 2 instead of 3 as shown. The overall answer will hence be 3 instead of 4. Please correct it

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety +2

      Thank you @Code Ninja. It was an honest mistake. I missed checking the first case. I considered putting down the video since youtube doesn't allow you to edit once the video is up but since explanation was right and the mistake is only at very end - I am adding this to description. Thanks again for pointing it out! Hope this never happens again!

    • @codeninja8813
      @codeninja8813 Před 4 lety +2

      @@KeertiPurswani Thanks for responding in. The intent was only to help share honest feedback as this would benefit other folks learning in as well. These are amazing videos. Keep doing the good stuff! All the best ahead.

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety +2

      Thank you so much! It really means a lot 😊☺️

  • @ghoshdipan
    @ghoshdipan Před 3 lety

    Great explanation. And please make a space optimization video!

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

      It's already there.
      Check it out - czcams.com/video/7C_FIc7PytA/video.html
      Hope you like it! 😇

    • @ghoshdipan
      @ghoshdipan Před 3 lety

      @@KeertiPurswani Thank you so much didi.

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Hope you like it! 😇

  • @divyanshudwivedi3756
    @divyanshudwivedi3756 Před 2 lety

    Can you explain top down approach ?

  • @brawlstarsac3574
    @brawlstarsac3574 Před 9 měsíci

    Is it necessary to learn recursion, if without knowing recursion, can we directly jump into tabulation in dp?. If all subproblems can be solved using dp, should we need to go for recursion( except tree and graph traversals)?

  • @RakeshKumar-tr5yg
    @RakeshKumar-tr5yg Před 4 lety +1

    nice

  • @nitin9042
    @nitin9042 Před 2 lety

    Mam try to use pen tab. It will more efficient than whiteboard

  • @abhishekkamboj7150
    @abhishekkamboj7150 Před 2 lety

    👍👍👍❤❤

  • @uditasen4411
    @uditasen4411 Před 3 lety

    Maam, I think in the second condition at 6:10 it should be str[i-1]==str[j-1], please correct me if I understood anything wrong. Thank You

  • @ankitkumarmahato4318
    @ankitkumarmahato4318 Před 3 lety

    Mam i understood it preety well but i don't get it that how would i think in this way while solving.

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      It will come with practise. Focus on understanding the logic and thought process 😊

  • @RiyaSingh-nj1fx
    @RiyaSingh-nj1fx Před 2 lety

    I love you Keerti💞💞💞

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

    the minimum operation will be 3

  • @nirjharpaul
    @nirjharpaul Před 3 lety

    Why do you need this matrix .. just create two array for storing the char count. Check how many add and delete operation are there. Take the maximum of two, because one delete and one add operation is basically a replace operation .. this should be the easiest explanation. 20 mins for this?