366. Find Leaves of Binary Tree

Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty.


DFS好烦,大神用高度相等的办法递归


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Given a binary tree, collect a tree's nodes as if you wer...
    matrxyz阅读 376评论 0 0
  • Given a binary tree, collect a tree's nodes as if you wer...
    Jeanz阅读 331评论 0 0
  • 背景 一年多以前我在知乎上答了有关LeetCode的问题, 分享了一些自己做题目的经验。 张土汪:刷leetcod...
    土汪阅读 12,766评论 0 33
  • 总结类型: 完全子树(#222) BST(左右子树值的性质,注意不仅要满足parent-child relatio...
    __小赤佬__阅读 717评论 0 0
  • 今天在大巴车上听了罗辑思维的两段节目,一是爱因斯坦的崛起,二是我为何不信中医,随手记一下。 1,科学共同体:科学共...
    咸鱼茄子阅读 540评论 0 0