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閱讀 378評論 0 0
  • Given a binary tree, collect a tree's nodes as if you wer...
    Jeanz閱讀 332評論 0 0
  • 背景 一年多以前我在知乎上答了有關LeetCode的問題, 分享了一些自己做題目的經驗。 張土汪:刷leetcod...
    土汪閱讀 12,775評論 0 33
  • 總結類型: 完全子樹(#222) BST(左右子樹值的性質,注意不僅要滿足parent-child relatio...
    __小赤佬__閱讀 725評論 0 0
  • 今天在大巴車上聽了羅輯思維的兩段節目,一是愛因斯坦的崛起,二是我為何不信中醫,隨手記一下。 1,科學共同體:科學共...
    咸魚茄子閱讀 547評論 0 0