class Solution { public: vector modes; int maxCnt = 0; int curCnt = 0; int curNum = 0; vector findMode(TreeNode* root) { if (!root) { return modes; } ... ...
分类:
其他好文 时间:
2019-02-15 17:20:32
阅读次数:
146
Invert a binary tree. 思路1 递归: 把左子树和右子树进行交换。交换完之后,再去递归翻转左子树和右子树 思路2 遍历 换父节点的时候,把子节点存下来,然后换完父节点了,就去换子点的。 ...
分类:
其他好文 时间:
2019-02-14 23:58:41
阅读次数:
324
"7. Serialize and Deserialize Binary Tree" / "297. Serialize and Deserialize Binary Tree" 本题难度: Medium/Hard Topic: Binary Tree Description Design an a ...
分类:
其他好文 时间:
2019-02-14 23:57:27
阅读次数:
302
"700. Search in a Binary Search Tree" 本题难度: Easy Topic: Binary Tree Description Given the root node of a binary search tree (BST) and a value. You nee ...
分类:
其他好文 时间:
2019-02-14 22:29:28
阅读次数:
164
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident ...
分类:
其他好文 时间:
2019-02-14 22:19:34
阅读次数:
204
"95. Validate Binary Search Tree" / "98. Validate Binary Search Tree" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, determine if it i ...
分类:
其他好文 时间:
2019-02-14 22:12:44
阅读次数:
199
"97. Maximum Depth of Binary Tree" / "104. Maximum Depth of Binary Tree" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, find its maxim ...
分类:
其他好文 时间:
2019-02-14 20:52:17
阅读次数:
169
"93. Balanced Binary Tree" / "" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, determine if it is height balanced. For this problem, a ...
分类:
其他好文 时间:
2019-02-14 20:37:15
阅读次数:
145
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n ...
分类:
其他好文 时间:
2019-02-14 15:05:23
阅读次数:
168
给定一张$n$个点,$m$条边的无向连通图以及$q$次询问,每次询问给出$S,E,L,R$,问你是否能从$S$出发,不经过编号小于$L$的点到达某个编号大于等于$L$且小于等于$R$的点,此时切换状态,不经过编号大于$R$的点到达$E$。 $$n\le200000,m\le400000,q\le20 ...
分类:
其他好文 时间:
2019-02-13 22:49:07
阅读次数:
187