Coding Interview Question | Wildcard Matching | Dynamic Programming with Optimization

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • LeetCode Link - leetcode.com/problems/wildcar...
    Video includes following details-
    0:00-2:44 - Question explanation with examples
    2:44-3:44 - Approach
    3:44-4:45 - Visualisation of dp
    4:45-7:55 - Initial Conditions
    7:55-12:30 - Formation of Algo using examples
    12:30-18:30 - Dry run of Algo with explanation
    18:30-20:30- Optimizations
    Please subscribe to my channel - / keertipurswani
    LinkedIn - / keertipurswani
    Instagram - keerti.purs...

Komentáře • 122

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

    It went inside my head very well!! Thank you Keerti 🤗

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

    Thanks for such a detailed explanation.

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

    Hey, Thank you so much all your knowledge sharing. I am able to perform very nice in all my interviews. Keep up the good work. More power to you.
    Keep rocking!!!

  • @hiteshgupta219
    @hiteshgupta219 Před 4 lety +6

    One of the best explanation I have ever seen. Thank you for the video.

  • @HarshGangwar
    @HarshGangwar Před 4 lety +3

    Can u plz explain 'Super Washing Machines' problem of Leetcode?

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

    Thank you for the video, your explanations are awesome!!

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

    Nice explanation of the initial conditions as I found it is the most tricky part.

  • @shauryasingh2212
    @shauryasingh2212 Před 2 lety

    @4:35 why strings are represented vertically and patterns horizontally

  • @reyazahmed9320
    @reyazahmed9320 Před 3 lety

    Good explanation... I was looking for the initial conditions after watching Tushar video.

  • @namangirdhar8736
    @namangirdhar8736 Před 3 lety

    Excellent explanation for this problem !...i can say this was the final destination for me after roaming through many videos on youtube ... thanks al lot👍

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

    This is a great explaination

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

    Great explanation !! I have not understood the solution to this problem until I have seen this video, thank you so much for sharing!!!!

  • @kevinliao2316
    @kevinliao2316 Před 3 měsíci

    Thank you for such a clear explanation, Keerti!!

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

    Thank you very much, got to know how from recursive approach getting to DP approach

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

    Finally, a video I could understand. Thanks a lot for doing this Keerti.

  • @arihantpatil2725
    @arihantpatil2725 Před 2 lety

    Didn't understand why asterisk could check the upper box value?

  • @kms8320
    @kms8320 Před 3 lety

    Great explanation!!! it would be a great help if you make a video on memoization approach.

  • @juda550
    @juda550 Před 2 lety

    This is so good!! Thank you!

  • @rabindrapatra7151
    @rabindrapatra7151 Před 2 dny

    Strange how did you came up with this solution, what is the intention behind this matrix.

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

    Great explanation. Thank you.
    Keep up the good work. 👍

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

    Thanks for discussing the optimization part!

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      I now have a separate video on it, check it out and let me know if you like it!
      czcams.com/video/7C_FIc7PytA/video.html

  • @manavgarg5000
    @manavgarg5000 Před 3 lety

    for * case it should be i-2 because if we consider empty b* get disappeared. Please correct if i am worng.

  • @prajwalgadad
    @prajwalgadad Před 2 lety

    Would you be able to show us how to arrive to the subproblem? Also top down approach is more intuitive and then we could come up with bottom up approach from the sub problems being repeated in the top down approach. Here in the above video it leaves us no choice other than memorizing the approach.

  • @aromasen7063
    @aromasen7063 Před 3 lety

    Can you please tell me why for initialisation, if the pattern[j] is * then we need to check the previous column?

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Watch the part from 5:48 again 🙂
      As I said, * can represent an empty string as well. So if pattern was just ****, then it's true for empty string 🙂

  • @ganeshkamath89
    @ganeshkamath89 Před 2 lety

    I understood the logic finally. Thank you.

  • @mandyyao9169
    @mandyyao9169 Před 2 lety

    you killed it girl! Thanks so much

  • @rashmin3112
    @rashmin3112 Před 3 lety

    One of the best explanation i found for this problem! Thank you :)

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Thank you so much 🥺🥺
      Hope you like rest of the videos as well 😇

  • @argonlaser2775
    @argonlaser2775 Před 2 lety

    Best explanation. I am appreciating dp more after seeing your videos.

  • @krishnakanthd6475
    @krishnakanthd6475 Před 2 lety

    Thank you for the detailed explanation :)

  • @searchandresearchdevelopme2322

    Good Going Keerti ...All the Best

  • @ShivamKumar-qv6em
    @ShivamKumar-qv6em Před 3 lety

    mind blowing . I have taken a course on coding ninjas & they didn't explain it well , & then i found ur vedio .Awesome , Great work , Plz make more videos on even more difficult questions. U are superb .

  • @raj_kundalia
    @raj_kundalia Před rokem

    thank you so much!

  • @04mfjoyce
    @04mfjoyce Před 3 lety

    Thank you very much! This was very helpful.

  • @DhairyaSharma-ge2mf
    @DhairyaSharma-ge2mf Před 3 lety

    Sis please reply.
    Could you please explain me project Euler archive 51.
    That problem uses wild card string(I think so). So please help me.🙇

  • @TanviSurana20
    @TanviSurana20 Před 2 lety

    Damn your solutions make these questions appear so simple! Keep posting!

  • @jarjarbinks9937
    @jarjarbinks9937 Před rokem

    I mean why not use the greedy approach? It is better in both space & time complexity than DP

  • @suvrobanerjee2399
    @suvrobanerjee2399 Před 2 lety

    Good explanation, thanks

  • @nilmaniprashant4389
    @nilmaniprashant4389 Před 3 lety

    Your videos clear some of my basic doubts.

  • @RahulGupta-tb2cr
    @RahulGupta-tb2cr Před 3 lety

    Great Explanation.
    Thanks a lot

  • @darthvader_
    @darthvader_ Před 2 lety

    Great video explanation!

  • @ayushraj-zb6sv
    @ayushraj-zb6sv Před 4 lety

    please tell the top down approach..like how to come up with recursive solution and then memoisation.interviers like to see the recursive solution and that is mainly expected.
    what u r sharing is last approach bottom up..

    • @ayushraj-zb6sv
      @ayushraj-zb6sv Před 4 lety +1

      @@KeertiPurswani actually all youtubers are solving by same approach like tushar roy..it would be helpful if u talk about top down recursive....thanks :)

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety

      I completely get it :) But the main reason is to avoid videos becoming even longer, but if people need it- I will definitely consider making separate videos on Recursive solutions :) Also, I have covered these approaches in LCS video and I can notice that retention of users was lot lesser :)

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety

      Thanks for the feedback @ayush raj. This will help me make better videos :)

    • @AbhishekSingh-op2tr
      @AbhishekSingh-op2tr Před 4 lety

      DP is about two things: 1> How a problem relates to it's subproblem, 2>How not to solve a problem again and again. The second part is generally easy once you have solved few DP problems, you just know how your dp structure will look like. It's the first part which is hard to figure out, and the video explains that very well. Now it's your choice how you want to code it, recursive or bottom up. And if you have really understood, it's not difficult to convert one into another. Also, I am not sure about interviewers like to see and expect recursive solution, again it's about how an individual thinks. My preference is bottom up, as recursion is easy but costly.

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

    Nice explanation! Please use more space on the white board!

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

    Thanks for detailed explanation

    • @shilpashreev1649
      @shilpashreev1649 Před 4 lety

      But when I was trying to solve the problem in leetcode with this logic , some edge case is missing for *. You may try looking at it

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety

      Sure, send the code to me on LinkedIn :)

  • @sriramkasu5286
    @sriramkasu5286 Před 3 lety

    why not ab*a represent aba...since taking * as an empty sequence makes ab*a = aba right

  • @radhesaini9689
    @radhesaini9689 Před 3 lety

    Amazing explanation here from all

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Thanks! 😇😇
      Hope you like rest of the videos as well ❤️

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

    dp should be explained in this manner - recursive + memoization

    • @prateeksinghal630
      @prateeksinghal630 Před 4 lety +3

      So True !!
      These CZcamsrs should learn from Aditya Verma's series on dp !!

    • @naveennoel9496
      @naveennoel9496 Před 3 lety

      @@prateeksinghal630 Lets not discourage man

    • @prateeksinghal630
      @prateeksinghal630 Před 3 lety

      @@naveennoel9496 This is not to discourage anyone !!
      If I was trying to discourage anyone then I would have stated that the video is bad and all the BS !!
      I was giving just genuine feedback that dp should be tackled in a progressive manner (recursion + memoization + iterative)

    • @girikgarg1268
      @girikgarg1268 Před 3 lety

      @aatif So true!

  • @harikeshbyrandurgagopinath2460

    Great explaination ma'am!!!!

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

    great explanation mam
    helpful video

  • @shivamtyagi3554
    @shivamtyagi3554 Před 4 lety

    mam ..i m not understand pat[j-1] means that a=?........for value j=2

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

      Pat[j-1] is because I have added an extra column in starting. So, in the example pat[0] is 'a' which is at 1st column in matrix (not 0)

    • @shivamtyagi3554
      @shivamtyagi3554 Před 4 lety

      @@KeertiPurswani thank u mam....

  • @jayeshkaushik4334
    @jayeshkaushik4334 Před 3 lety

    Best explanation

  • @codeblooded6760
    @codeblooded6760 Před 3 lety

    Very insightful👌🏻

  • @KunalKumar-nj4kf
    @KunalKumar-nj4kf Před 4 lety +1

    you explain very well

  • @sriramphysics5853
    @sriramphysics5853 Před 22 dny

    wroth watching 20 minutes well done Keerti

  • @abhaytiwari5013
    @abhaytiwari5013 Před 3 lety

    really nice explanation.

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

    nice explanatiom

  • @anveshreddy1245
    @anveshreddy1245 Před 3 lety

    Is it your own solution? Sis

  • @prasantharavindramesh1078

    fantastic explanation

  • @d3thdrive
    @d3thdrive Před 3 lety

    Best explanation lol. Don't know why others struggle to explain.

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Thank you 🙏🙏😇😇 Hope you like rest of the videos as well!

  • @misubgify
    @misubgify Před 3 lety

    Very good explanations

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      Thank you 😇😇
      Please do share it with your friends ❤️

  • @ghoshdipan
    @ghoshdipan Před 3 lety

    Didi please make a video on Regular Expression Matching, Leetcode #10
    A qs very hard to understand

    • @KeertiPurswani
      @KeertiPurswani  Před 3 lety

      So many requests for this one. Will cover for sure! 😇

  • @avinashjeeva723
    @avinashjeeva723 Před 3 lety

    Awesome video !!!!!!!!!!!!!!!!!!

  • @michaelchan6144
    @michaelchan6144 Před 3 lety

    Genius!

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

    Very nicely explained. Thanks a lot. Plz make a video on its optimisations too.

  • @AnkitBhimani
    @AnkitBhimani Před 3 lety +3

    You may also solve this very efficiently using Tries if the input/output is in the following format:
    Input: List of word strings, List of pattern strings
    Output: List of booleans for the pattern strings
    1. Add words to trie with a last node as end of word
    2. For each pattern use DFS:
    2.1 if ? omit the character
    2.2 If * look for the next character in the DFS
    2.3 If end of word reached, return true

  • @hariommewada3768
    @hariommewada3768 Před 2 lety

    beauty with brain

  • @siwi_drake4703
    @siwi_drake4703 Před 4 lety

    Hum toh solution ko nahi sirf aapko dekh rahe the...aapke chehre se nazar hi nahi hatt rahi thi😁😁😁

    • @nammi895
      @nammi895 Před 3 lety

      Abe padai likhai pe dhyan do IAS Vias bano desh ko sambhalo 😂

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

      @Naman 😂😂😂😂 🙏🙏🙏

    • @siwi_drake4703
      @siwi_drake4703 Před 3 lety

      @@KeertiPurswani i love u...

    • @siwi_drake4703
      @siwi_drake4703 Před 3 lety

      @@KeertiPurswani what u do apart from u tube? R u employed or not

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

      @siwi studios, try checking me out on LinkedIn if you love me 🤭🤭😂😂
      Jk. I am a software developer. Currently working at Intuit

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

    I think it fails here S =aa p=*

    • @KeertiPurswani
      @KeertiPurswani  Před 4 lety

      No it doesn't, did you try running the code? Share it with me

    • @ashutoshbisht3580
      @ashutoshbisht3580 Před 3 lety

      @@KeertiPurswani check S="albmnc" p="*?b*c"
      in this, if we make a memoization table then it will get fails in s="a" and p="*?b*c"

    • @ashutoshbisht3580
      @ashutoshbisht3580 Před 3 lety

      for solving this you have to introduce one conditon more
      m: m is the length of the pattern
      for (int j = 1; j

    • @dhananjayarjundavala3586
      @dhananjayarjundavala3586 Před 3 lety

      Ashutosh bisht yeah I got it later

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

    Damm she become SDE 2 with experience of just 2 year & still has some hobbies left #respect 🙌🙌🤐

  • @aatifnazar8203
    @aatifnazar8203 Před 4 lety

    recursive solution passed all cases on leetcode
    class Solution
    {
    public boolean isMatch(String A, String B)
    {
    int m = A.length();
    int n = B.length();
    int dp[][] = new int[m][n];

    for(int i=0; i