摘要: struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) { struct ListNode *posA = headA; struct ListNode *posB = headB; i 阅读全文
posted @ 2020-08-24 20:51 温暖了寂寞 阅读(146) 评论(0) 推荐(0) 编辑
摘要: int count; void fun(struct TreeNode* node,int* arr) { if (!node) return; arr[count++] = node->val; fun(node->left,arr); fun(node->right,arr); } int My 阅读全文
posted @ 2020-08-24 14:15 温暖了寂寞 阅读(201) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /* 对于一个公共祖先(一定有子节点才 阅读全文
posted @ 2020-08-24 11:41 温暖了寂寞 阅读(122) 评论(0) 推荐(0) 编辑
摘要: int maxDepth(struct TreeNode* root){ if (root == NULL) { return 0; } int lenLeft = maxDepth(root->left) + 1; int lenRight = maxDepth(root->right) + 1; 阅读全文
posted @ 2020-08-24 09:29 温暖了寂寞 阅读(109) 评论(0) 推荐(0) 编辑