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
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.
Such a clear and great video. Thanks so much!
you have to slightly change the code because this code doesn't work for string = "aa" , pattern = "*";
modified code
for (int i = 0; i
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]
very clear explanation thank you
Doesn't work if the pattern starts with *
That was helpful. Thank you!
Superb explanation!
Man you are amazing
Great Explanation!
What do you mean good explanation, he explained how and not why the entire video
Nice, Keep up the good work
Thanks🎉
Can you share the source code using Python?
You are trying so hard to hide your Bengali accent with as much American as possible, I could not focus on your approach :)
Bhai accent kyu badal raha hai.
I'm trying to learn English, i'm improving day by day. Thanks for pointing out.
bro u dont have to do the accent man...
Yes, you are right. I have changed my accent. Thanks for pointing out.