Why it is giving wrong ans after 20


#1

Commepublic class Solution {
public int chordCnt(int n) {
int cat[]= new int[n+1];
cat[0]=1;
cat[1]=1;
for(int i =2;i<=n;i++){
cat[i]=0;
for(int j=0;j<i;j++){
cat[i]+=(cat[j]*cat[i-j-1]);
}
cat[i]= cat[i]%1000000007;
}
return cat[n]%1000000007;

}

}
nt body goes here.


#2

Use long long instead of int. Might help.