每跑過一輪時,將currents 合併回結果,將childs 寫入stack 作為下一輪需要考慮的點。 用Python 實作一次. class Solution: def levelOrder(self, root: TreeNode) -> List ...
確定! 回上一頁