摘要:
class Solution { public: vector<vector<int>> levelOrder(TreeNode* root) { vector <vector <int>> ret; if (!root) { return ret; } queue <TreeNode*> q; q 阅读全文
摘要:
bool recursion(struct TreeNode* root,long lower,long upper){ if(!root) return true; if(root->val <= lower || root->val >= upper) return false; return 阅读全文
摘要:
struct TreeNode** buildTree(int start, int end, int* returnSize) { if (start > end) { (*returnSize) = 1; struct TreeNode** ret = malloc(sizeof(struct 阅读全文
摘要:
int numTrees(int n){ int hash[50]={0} ,i, j; hash[0]=1; for(i=1; i<=n; i++) for(j=1; j<=i; j++) hash[i] += hash[j-1]*hash[i-j]; return hash[n]; } 阅读全文