题目: 题目链接: https://leetcode-cn.com/problems/binary-tree-right-side-view/ 解题思路: 树的层序遍历,先放左节点,再放右节点 每次将一层都放完的时候,将最后一个放入的元素加入到结果集中,其余直接清空 然后继续遍历下一层 代码实现: # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self