LeetCode 44. Wildcard Matching | Wildcard Matching LeetCode | Wildcard Matching Dynamic Programming

Поділитися
Вставка
  • Опубліковано 12 вер 2024
  • ⚡️My Courses on Udemy:
    ▶️ Data Structures & Algorithms for Coding Interview: www.udemy.com/...
    🈚️ BEST RESOURCES FOR SOFTWARE ENGINEERING PREP
    🌡️ Tech Interview Pro Discount Link: www.techseries...
    🌡️ Coder Pro Discount Link: www.techseries...
    🌡️ UA-cam Backstage Discount Link: www.techseries...
    📝Statement: Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'.
    1. '?' Matches any single character.
    2. '*' Matches any sequence of characters (including the empty sequence).
    The matching should cover the entire input string (not partial).
    Note:
    s could be empty and contains only lowercase letters a-z.
    p could be empty and contains only lowercase letters a-z, and characters like ? or *.
    ✔️Source code: github.com/tec...
    👨‍💻Link to the problem: leetcode.com/p...
    🎬LeetCode PlayList: • LeetCode Solution
    ✅️BEST RESOURCES FOR SOFTWARE ENGINEERING PREP
    🗺️Cracking The Coding Interview: amzn.to/3i5bPkE
    🗺️Daily Coding Problem: amzn.to/3n3NaAL
    ✅️EQUIPMENT I USED IN THIS VIDEO:
    🎤Microphone: amzn.to/2G2xtsI
    ✴️PRACTICE CODING QUESTIONS
    👨‍💻LeetCode: leetcode.com/
    👨‍💻HackRank: www.hackerrank...
    ❇️FREE RESOURCE ONLINE
    🟠www.geeksforge...
    ⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
    ⭐ Tags ⭐
    - LeetCode
    - Software Engineering
    - Wildcard Matching
    - Dynamic Programming
    - LeetCode 44. Wildcard Matching
    - Wildcard Matching Leetcode
    - LeetCode Wildcard Matching
    - Wildcard Matching Dynamic Programming
    - Algorithms
    - Programming
    - Coding
    ⭐ Hashtags ⭐
    #leetcode
    Disclosure: Some links are affiliate links to products. I may receive a small commission for purchases made through these links. #csninja

КОМЕНТАРІ • 19

  • @savarchaturvedi4223
    @savarchaturvedi4223 4 роки тому +6

    if s is zero and there is pattern (*)then the value should be true but who have written false.
    cell[0][4] is false but should be true.

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

    Such a clear and great video. Thanks so much!

  • @wpraagavendran4758
    @wpraagavendran4758 10 місяців тому +1

    you have to slightly change the code because this code doesn't work for string = "aa" , pattern = "*";
    modified code
    for (int i = 0; i

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

    I think there's a typo in the if statement when checking for the '?'
    Shouldn't s[j-1] == '?' be p[j-1] == '?', since our p is the pattern and we can find the '?' in the p string?
    Overall everything is good, here's my Python implementation:
    class Solution(object):
    def isMatch(self, s, p):
    """
    :type s: str
    :type p: str
    :rtype: bool
    """
    N = len(s)
    M = len(p)
    dp = [[False] * (M + 1) for _ in range(N + 1)]
    dp[0][0] = True
    for j in range(1, M + 1):
    if p[j-1] == "*":
    dp[0][j] = True
    else:
    break
    for i in range(1, N + 1):
    for j in range(1, M + 1):
    if s[i-1] == p[j-1] or p[j-1] == "?":
    dp[i][j] = dp[i-1][j-1]
    elif p[j-1] == "*":
    dp[i][j] = dp[i-1][j] or dp[i][j-1]
    return dp[N][M]

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

    very clear explanation thank you

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

    Doesn't work if the pattern starts with *

  • @klimmy.
    @klimmy. 3 роки тому

    That was helpful. Thank you!

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

    Superb explanation!

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

    Man you are amazing

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

    Great Explanation!

    • @ryanben3988
      @ryanben3988 Рік тому +1

      What do you mean good explanation, he explained how and not why the entire video

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

    Nice, Keep up the good work

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

    Thanks🎉

  • @Pradeep-ih8zh
    @Pradeep-ih8zh 3 роки тому

    Can you share the source code using Python?

  • @Drew0Ranger
    @Drew0Ranger 25 днів тому

    You are trying so hard to hide your Bengali accent with as much American as possible, I could not focus on your approach :)

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

    Bhai accent kyu badal raha hai.

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

      I'm trying to learn English, i'm improving day by day. Thanks for pointing out.

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

    bro u dont have to do the accent man...

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

      Yes, you are right. I have changed my accent. Thanks for pointing out.