摘要:
题目 代码 1 class Solution { 2 public: 3 TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) { 4 if(preorder.size() == 0) return NULL; 5 //找根 阅读全文
posted @ 2021-03-10 22:25
Uitachi
阅读(64)
评论(0)
推荐(0)
摘要:
题目 代码 1 class Solution { 2 public: 3 4 TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) { 5 //第一步 6 if(postorder.size() == 0) return 阅读全文
posted @ 2021-03-10 21:55
Uitachi
阅读(74)
评论(0)
推荐(0)
摘要:
题目 代码 层次遍历(一) 1 class Solution { 2 public: 3 int getDepth(TreeNode* root){ 4 if(root == NULL) return 0; 5 return max(getDepth(root->left),getDepth(roo 阅读全文
posted @ 2021-03-10 18:27
Uitachi
阅读(66)
评论(0)
推荐(0)
摘要:
题目 代码 线性dp 1 class Solution { 2 public: 3 int findLengthOfLCIS(vector<int>& nums) { 4 if(nums.size() <= 1) return nums.size(); 5 vector<int>dp(nums.si 阅读全文
posted @ 2021-03-10 17:05
Uitachi
阅读(58)
评论(0)
推荐(0)
摘要:
题目 代码 1 class Solution { 2 public: 3 int lengthOfLIS(vector<int>& nums) { 4 if(nums.size() <= 1) return nums.size(); 5 vector<int>dp(nums.size()+1,1); 阅读全文
posted @ 2021-03-10 16:51
Uitachi
阅读(49)
评论(0)
推荐(0)

浙公网安备 33010602011771号