翻译 给定一个二叉树,返回从下往上遍历经过的每一个节点的值. 从左往右,从叶子到节点. 比如: 给定的二叉树是 {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 返回它从下往上的遍历结果: [ [15,7], [9,20], [3] ] 原文 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, lev
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 or
第一种方法: import collections d = collections.OrderedDict([('a',1),('b',2),('c',3)]) ''' 或者把上面的那一行改成: d = collections.OrderedDict() d['a'] = 1 d['b'] = 2 d['c'] = 3 ''' for k,v in d.items(): print(k,v) 输出结果: a 1 b 2 c 3 第二种方法: from collections import Ord