LeetCode-107

Links:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/

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,#,#,15,7},

return its bottom-up level order traversal as:

 

方法1:递归层序遍历,然后返回rbegin,rend…

方法2:循环.

思路:用queue的特性,一层一层的访问。

 

【LeetCode】107. Binary Tree Level Order Traversal II
Tagged on:
0 0 投票数
Article Rating
订阅评论
提醒

0 评论
最新
最旧 最多投票
内联反馈
查看所有评论