diff --git a/Wildcardmatching/README.md b/Wildcardmatching/README.md new file mode 100644 index 0000000..a011d33 --- /dev/null +++ b/Wildcardmatching/README.md @@ -0,0 +1,34 @@ +# Readme + +***Wild card matching using Dynamic Programming*** + +This is a dynamic programing approach to match the given string with a given pattern. + +The pattern can be empty and can contain only lowercase letters a-z, and characters like ? or *. +The string can be empty and can contain only lowercase letters a-z. + +'?' Matches any single character. +'*' Matches any sequence of characters (including the empty sequence). + +The matching will cover the entire input string (not partial). + +***Example 1:*** + +```Input:``` +s = "aa" +p = "a" + +```Output:``` aa doesn't match with the given pattern: a? + +```Explanation:``` "a" does not match the entire string "aa". + +***Example 2:*** + +```Input:``` +s = "aa" +p = "*" + +```Output:``` aa matches the pattern: *? + +```Explanation:``` '*' matches any sequence. + diff --git a/Wildcardmatching/input.txt b/Wildcardmatching/input.txt new file mode 100644 index 0000000..6cf9f77 --- /dev/null +++ b/Wildcardmatching/input.txt @@ -0,0 +1,23 @@ +Enter a pattern: a*b? +Enter a string (enter q to quit): +abcdefbh +abcdefbh matches the pattern: a*b? + +Enter a string (enter q to quit): +abf +abf matches the pattern: a*b? + +Enter a string (enter q to quit): +acdb +acdb doesn't match with the given pattern: a*b? + +Enter a string (enter q to quit): +ab +ab doesn't match with the given pattern: a*b? + +Enter a string (enter q to quit): +abfbfbfbf +abfbfbfbf matches the pattern: a*b? + +Enter a string (enter q to quit): +q