Hi.

I am using bottom up dp with extra memory to calculate the validity of given string.

My code first initializes the base case values and then do further calculation in bottom up format.

However, I am still getting Runtime error on this pretty long input.

Thanks for any help in advance.

```
class Solution {
public:
bool isMatch(const char *s, const char *p) {
string ss(s);
string pp(p);
int m = ss.size();
int n = pp.size();
if (s == NULL || p == NULL)
return false;
bool OPT[m+1][n+1];
OPT[0][0] = true;
for (int i = 1; i <= m; i++)
OPT[i][0] = false;
for (int j = 1; j <= n; j++)
OPT[0][j] = (pp[j-1] == '*') && OPT[0][j-1];
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
{
OPT[i][j] = ( (OPT[i-1][j-1]) && equals(ss, pp, i-1, j-1) ) || ( (OPT[i-1][j]) && (pp[j-1] == '*') )
|| ((OPT[i][j-1]) && (pp[j-2] == '*') && (equals(ss, pp, i-1, j-1)));
}
return OPT[m][n];
}
bool equals(string s, string p, int si, int pi) {
return (s[si] == p[pi] || p[pi] == '?');
}
};
```