Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which is based on Splay trees. Specifically, he is now studying the ...
分类:
其他好文 时间:
2020-04-12 20:18:43
阅读次数:
92
111. 二叉树的最小深度 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 /** * Definitio ...
分类:
其他好文 时间:
2020-04-12 18:45:50
阅读次数:
57
地址:https://leetcode cn.com/problems/binary tree preorder traversal/submissions/ 大意:前序遍历一棵树 ` ` ...
分类:
其他好文 时间:
2020-04-12 18:34:41
阅读次数:
64
1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), ...
分类:
其他好文 时间:
2020-04-12 18:30:30
阅读次数:
65
1. 编译报错,提示不支持 解决思路一: 排查一些库文件或者代码文件有没有导入,一般为依赖文件找不到导致报错, Build Phases complite sources 或者 link binary with libraries ,未添加的文件加进去,如果还是不行再试试其他问题 ...
分类:
移动开发 时间:
2020-04-12 10:57:05
阅读次数:
85
104.求二叉树的最大深度 class Solution: def maxDepth(self, root: TreeNode) -> int: if root == None: return 0 else: leftdepth = self.maxDepth(root.left) rightdep ...
分类:
其他好文 时间:
2020-04-12 10:47:43
阅读次数:
73
要求 给定一棵二叉树,返回所有表示从根节点到叶子节点路径的字符串 思路 递归地返回左右子树到叶子节点的字符串 示例 1 class Solution { 2 public: 3 vector<string> binaryTreePaths(TreeNode* root) { 4 5 vector<s ...
分类:
其他好文 时间:
2020-04-12 10:44:25
阅读次数:
60
XML模块:(用到的时候再看)tree=xml.parse('xmltest.xml')root= tree.getroot()print(root.tag) 打印对象的标签root.attrib 获取对象的属性root.text 获取对象的文本内容 RE模块:re.findall("匹配条件"," ...
分类:
其他好文 时间:
2020-04-12 07:49:20
阅读次数:
66
二叉树最大深度 DFS递归法 BFS(借助队列) ...
分类:
其他好文 时间:
2020-04-12 00:07:49
阅读次数:
72
二叉搜索树的第k大节点 递归法 中序遍历的二叉搜索树序列为单调递增的序列,将中序遍历的结果放到vector中,第k大的数为v.size() k位置的数 迭代法 ...
分类:
其他好文 时间:
2020-04-12 00:02:47
阅读次数:
91