```
class Solution {
public:
int minCut(string s) {
int n = s.size();
int f[n+1];
for(int i = 0; i<=n;++i)
f[i] = n-i-1;
bool p[n][n];
memset(p,false,sizeof(p));
//fill_n(&p[0][0], n * n, 0);
for(int i=n-1;i>=0;--i)
for(int j = i;j<=n-1;++j)
{
if(s[j]==s[i]&&(j-i<2||p[i+1][j-1])){
p[i][j] = true;
f[i] = min(f[i],1+f[j+1]);
}
}
return f[0];
}
};
```

the above code passed.

However, if I change

```
bool p[n][n];
memset(p,false,sizeof(p));
```

to

```
int p[n][n];
memset(p,0,sizeof(p));
```

or

```
int p[n][n];
fill_n(&p[0][0], n * n, 0);
```

it will result in a run time error.... Why, I still couldn't understand it clearly. I think they are same....