上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 63 下一页
摘要: struct Node* connect(struct Node* root) { if (root == NULL) { return root; } // 从根节点开始 struct Node* leftmost = root; while (leftmost->left != NULL) { 阅读全文
posted @ 2020-12-18 14:55 温暖了寂寞 阅读(87) 评论(0) 推荐(0) 编辑
摘要: #define min(a,b) ((a)<(b))?(a):(b) int minimumTotal(int** triangle, int triangleSize, int* triangleColSize){ for (int i=triangleSize-2; i>=0; i--) for 阅读全文
posted @ 2020-12-18 12:08 温暖了寂寞 阅读(76) 评论(0) 推荐(0) 编辑
摘要: void flatten(struct TreeNode* root) { struct TreeNode* curr = root; while (curr != NULL) { if (curr->left != NULL) { struct TreeNode* next = curr->lef 阅读全文
posted @ 2020-12-18 11:18 温暖了寂寞 阅读(33) 评论(0) 推荐(0) 编辑
摘要: void recursion(struct TreeNode* root,int sum,int* returnSize,int* returnColumnSizes,int**arr,int* temp,int cnt,int* total){ if(!root) return; *(total) 阅读全文
posted @ 2020-12-17 18:42 温暖了寂寞 阅读(55) 评论(0) 推荐(0) 编辑
摘要: struct TreeNode* buildTree(int* inorder,int inorderSize,int* preorder,int preorderSize){ if(preorderSize==0 || inorderSize==0) return NULL; struct Tre 阅读全文
posted @ 2020-12-17 16:08 温暖了寂寞 阅读(88) 评论(0) 推荐(0) 编辑
摘要: int getLength(struct ListNode* head) { int ret = 0; while (head != NULL) { ++ret, head = head->next; } return ret; } struct TreeNode* buildTree(struct 阅读全文
posted @ 2020-12-17 14:28 温暖了寂寞 阅读(51) 评论(0) 推荐(0) 编辑
摘要: int** zigzagLevelOrder(struct TreeNode* root, int* returnSize, int** returnColumnSizes){ int** arr = (int**)calloc(100, sizeof(int*)); *returnSize = 0 阅读全文
posted @ 2020-12-17 14:24 温暖了寂寞 阅读(53) 评论(0) 推荐(0) 编辑
摘要: struct TreeNode* buildTree(int* preorder, int preorderSize, int* inorder, int inorderSize){ if(preorderSize==0 || inorderSize==0) return NULL; struct 阅读全文
posted @ 2020-12-16 17:46 温暖了寂寞 阅读(99) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<vector<int>> levelOrder(TreeNode* root) { vector <vector <int>> ret; if (!root) { return ret; } queue <TreeNode*> q; q 阅读全文
posted @ 2020-12-15 19:54 温暖了寂寞 阅读(97) 评论(0) 推荐(0) 编辑
摘要: bool recursion(struct TreeNode* root,long lower,long upper){ if(!root) return true; if(root->val <= lower || root->val >= upper) return false; return 阅读全文
posted @ 2020-12-15 17:20 温暖了寂寞 阅读(100) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 63 下一页