I thought this is efficient code but actually it falls into the slower half of Java solutions, anybody can point out any reason?

It's straightforward though, so if anyone doesn't have a clue, this may help :)

```
public int numTrees(int n) {
int[] v = new int[n + 1]; // v[n] is the number of trees with n values
v[0] = 1;
v[1] = 1;
numTrees(v, n);
return v[n];
}
private void numTrees(int[] v, int n) {
for(int i=2; i<=n; i++) {
for(int j=0; j<i; j++) {
v[i] += v[j] * v[i-j-1];
}
}
}
```