Unnamed Paste

int Solution::isMatch(const string A, const string B) { if (A.size() == 0) { return (B.size() == 0); } std::vector<std::vector> dp(A.size() + 1, std::vector(B.size() + 1, false));
for (int i = 0; i < dp.size(); i++)
{
    dp[i][0] = false;
}
for (int j = 0; j < dp[0].size(); j++)
{
    dp[0][j] = false;
}
dp[0][0] = true; 

for (int j = 1; j <= B.size(); j++)
{
    if (B[j - 1] == '*')
    {
        dp[0][j] = dp[0][j - 1];
    }
}

for (int i = 1; i < dp.size(); i++)
{
    for (int j = 1; j < dp[0].size(); j++)
    {
        if (A[i - 1] == B[j - 1] || B[j - 1] == '?')
        {
            dp[i][j] = dp[i - 1][j - 1];
        }
        else if (B[j - 1] == '*')
        {
            dp[i][j] = (dp[i-1][j] || dp[i][j-1]);
        }
        else
        {
            dp[i][j] = false;
        }
    }
}

return dp[A.size()][B.size()]; }