天天看点

[LeetCode] Binary Tree Right Side View解题思路实现代码1实现代码2

given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

for example:

given the following binary tree,

you should return [1, 3, 4].

层次遍历法,找出每一层最右端的结点。