Another approach to address this issue is through the use of a recursive function, though it is not as efficient as dynamic programming. This technique employs two pointers: one for the string and the other for the pattern. If the current character in the pattern is '?' or if the character in the string matches the one in the pattern, move both pointers forward. If the current character in the pattern is ' ', we keep a backup of the current positions of the string and pattern, advance the pattern pointer, and continue matching. If there is a mismatch, we revert the string to the next position using the backup and attempt to match again with ' '. When the end of the string is reached, verify the remainder of the pattern for any ' ' characters. If all remaining characters in the pattern are ' ', the function returns true; otherwise, it returns false. Below is the implementation in Python: def isMatch ( s , p ) : s_cur = p_cur = backup_s = backup_p = 0 while s_cur < len ( s ) : if p_cur < len ( p ) and ( s [ s_cur ] == p [ p_cur ] or p [ p_cur ] == '?' ) : s_cur += 1 p_cur += 1 elif p_cur < len ( p ) and p [ p_cur ] == '*' : backup_s = s_cur backup_p = p_cur + 1 p_cur += 1 elif backup_p != 0 : s_cur = backup_s + 1 backup_s += 1 p_cur = backup_p else : return False while p_cur < len ( p ) and p [ p_cur ] == '*' : p_cur += 1 if p_cur == len ( p ) : return True return False While this algorithm can effectively resolve the issue, it has a worst-case time complexity of O(SP), where S and P represent the lengths of the string and the pattern, respectively. In contrast, using dynamic programming can reduce the time complexity to O(SP), making it a more efficient solution.