摘要:
实际就是求斐波那契数列 int numWays(int n){ if (n == 0 || n == 1) return 1; int prepre = 1; int pre = 1; int curr = 0; for (int i = 2; i <= n; i++) { curr = prepr 阅读全文
摘要:
int height(struct TreeNode* root) { if (root == NULL) { return 0; } else { return fmax(height(root->left), height(root->right)) + 1; } } bool isBalanc 阅读全文
摘要:
int maxProfit(int* prices, int pricesSize){ int ans = 0; if(pricesSize>=2) { //交易日不满两天直接返回0 int max = prices[pricesSize-1]; //将max初始化为最后一天的值 int profi 阅读全文