Unique Binary Search Trees
使用带标记的DP
int result[1000]; int numTrees(int n) { result[0] = 1; result[1] = 1; result[2] = 2; // Start typing your C/C++ solution below // DO NOT write int main() function if(result[n] != 0) return result[n]; int num = 0, t; for(t = 1; t <= n; t++){ num = num + numTrees(t-1)*numTrees(n-t); } return num; }