```
class Solution {
public:
int numTrees(int n) {
// Base cases
if (n == 0 || n == 1) return 1;
// Do recursion
int treeCount = 0;
for (int i = 0; i != n; ++i)
treeCount += numTrees(i) * numTrees(n - 1 - i);
return treeCount;
}
};
```

Also easy to understand !