leetcode鍒烽-94浜屽弶鏍戠殑涓簭閬嶅巻
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode鍒烽-94浜屽弶鏍戠殑涓簭閬嶅巻相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/div' title='div'>div
root nbsp sel rsa pen end res 棰樼洰棰樼洰
缁欏畾涓€涓簩鍙夋爲锛岃繑鍥炲畠鐨?em>涓簭
閬嶅巻銆?/p>瀹炵幇
# def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: result = [] def inorder(tree, result): if tree != None: if tree.left != None: inorder(tree.left, result) result.append(tree.val) if tree.right != None: inorder(tree.right, result) inorder(root, result) return result
以上是关于leetcode鍒烽-94浜屽弶鏍戠殑涓簭閬嶅巻的主要内容,如果未能解决你的问题,请参考以下文章
涓€涓父瑙佺殑鏍℃嫑闈㈣瘯棰橈細浜屽弶鏍戠殑搴忓垪鍖栧拰鍙嶅簭鍒楀寲
[LeetCode] 255. Verify Preorder Sequence in Binary Search Tree 楠岃瘉浜屽弶鎼滅储鏍戠殑鍏堝簭搴忓垪
leetcode 0404 浜屽弶鏍戞鏌ュ钩琛℃€?DFS
LeetCode 236. Lowest Common Ancestor of a Binary Tree(浜屽弶鏍戞眰涓ょ偣LCA)