标签:rsa 出栈 val __init__ 一个 使用 treenode etc roo
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
ret = []
stack = []
while root or stack:
while root:
stack.append(root)
root = root.left
if stack:
t = stack.pop()
ret.append(t.val)
root = t.right
return ret
标签:rsa 出栈 val __init__ 一个 使用 treenode etc roo
原文地址:http://www.cnblogs.com/qiaojushuang/p/7841302.html