✅C++ || DP (Recursive + Memoization)
Code\n\nclass Solution {\npublic:\n    bool c(string &s,string &p,int i,int j,vector<vector<int>>&dp){\n        if(i==s.size()){\n            int t=0;\n        
# Code\n```\nclass Solution {\npublic:\n    bool c(string &s,string &p,int i,int j,vector<vector<int>>&dp){\n        if(i==s.size()){\n            int t=0;\n            for(int g=j;g<p.size();g++)if(p[g]==\'*\')t++;\n            if(t==(p.size()-j))return true;\n            else return false;\n        }\n        \n        if(j>=p.size() || i>s.size())return false;\n        if(dp[i][j]!=-1)return dp[i][j];\n        bool ans=false;\n        if(p[j]>=\'a\' && p[j]<=\'z\'){\n           if(s[i]!=p[j])ans=false;\n           else ans|= c(s,p,i+1,j+1,dp);\n        }\n        else if(p[j]==\'?\')ans|= c(s,p,i+1,j+1,dp);\n        else {\n            for(int h=i;h<s.size();h++){\n                    ans |= c(s,p,h+1,j+1,dp);\n                    ans |= c(s,p,h,j+1,dp);\n            }\n        }\n        dp[i][j]=ans;\n        return ans;\n    \n    }\n    bool isMatch(string s, string p) {\n        vector<vector<int>>dp(s.size(),vector<int>(p.size(),-1));\n        return c(s,p,0,0,dp);\n    }\n};\n```\n![upvote (3).jpg](https://assets.leetcode.com/users/images/78f09d88-c388-486a-89e7-1e3efd936b18_1681475282.875831.jpeg)\n
['C++']