根據中序遍歷和後序遍歷序列構造二叉樹

思路:從後往前遍歷後序數組,找到根節點,而後,構建右子樹,最後構建左子樹數組 class Solution { class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } private in
相關文章
相關標籤/搜索