• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
August 30, 2024 |680 Views

PROBLEM OF THE DAY : 26/08/2024 | Wildcard Pattern Matching

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Saurabh Bansal We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Dynamic Programming but also build up problem-solving skills.

Given two strings pattern and str which may be of different size, You have to return 1 if the wildcard pattern i.e. pattern, matches with str else return 0. All characters of the string str and pattern always belong to the Alphanumeric characters.

The wildcard pattern can include the characters ? and *
‘?’ – matches any single character.
‘*’ – Matches any sequence of characters (including the empty sequence).

Note: The matching should cover the entire str (not partial str).

Examples:

Input: pattern = "ba*a?", str = "baaabab" Output: 1 Explanation: replace '*' with "aab" and '?' with 'b'.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/wildcard-pattern-matching/1