天天看點

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 <code>{3,9,20,#,#,15,7}</code>,

return its bottom-up level order traversal as:

 隻是在上篇的基礎上,使用了棧結構來存放值,然後複制到vector&lt;vector&lt;int&gt;&gt;中。

C++代碼實作:

運作結果:

Binary Tree Level Order Traversal II

繼續閱讀