1. Add Sum

Description

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).

For example:

Given binary tree [3,9,20,null,null,15,7],

    3
   / \
  9  20
    /  \
   15   7

return its bottom-up level order traversal as:

[
  [15,7],
  [9,20],
  [3]
]

Tags: Tree, Breadth-first Search

题意

题意是从下往上按层遍历二叉树,每一层是从左到右,按层遍历

题解

思路1

宽搜就行了,因为是从下往上,所以插入的时候每次插到链表头即可。



思路2

思路2 ```go

```

结语

如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:awesome-golang-leetcode

results matching ""

    No results matching ""