Company: Amazon_30Aug
Difficulty: medium
Longest Wildcard Match Problem Description Amazon is developing a string matching library. You are to develop a service that finds the longest substring that matches a given regex. More formally, you are given two strings, a text string sourceString , and a regex expression pattern . The string pattern contains exactly one wildcard character ('*'). A wildcard character ('*') matches any sequence of zero or more lowercase English characters. A regex matches some string if it is possible to replace the wildcard character with some sequence of characters such that the regex expression becomes equal to the string. No other character can be changed. For example, a*b can match ab , acb , accb , acccb , and abbbb . whereas it does not match the strings aab , aaab , ac . Return the length of the longest substring of sourceString that matches the expression pattern . Return -1 if there is no such substring. Note: A substring is a contiguous sequence of characters within a string. Complete the f