title | tags | categories | author | comments | updated | permalink | mathjax | top | description | date | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|
[0515] 在每个树行中找最大值 |
|
|
张学志 |
true |
false |
false |
false |
... |
2019-12-31 16:08:35 -0800 |
您需要在二叉树的每一行中找到最大的值。
示例:
输入: 1 / \ 3 2 / \ \ 5 3 9 输出: [1, 3, 9]
Related Topics
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> largestValues(TreeNode* root) {
}
};