[Golang][Leetcode][BinaryTree]刷題系列-107-Level Order Traversal II

Contents
107. Binary Tree Level Order Traversal II
Level : Medium
原題連結 : Click
題目 :
Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root).
Example :
Note
Example 1:
Input: root = [3,9,20,null,null,15,7] Output: [[15,7],[9,20],[3]]
Example 2:
Input: root = [1] Output: [[1]]
Example 3:
Input: root = [] Output: []
解題思路 :
- 這題可以直接參考 leetcode102題解,使用到的觀念一模一樣,只是多一個反轉結果而已!!!
Queue解法
- time complexity: O(n) , space complexity: O(n)
Runtime: 0 ms, faster than 100.00% of Go online submissions for Binary Tree Level Order Traversal II.
|
|
最後祝福努力認真的各位 “All your dream of are hidden in your daily life” 我們峰頂見!!!