mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
优化0106.从中序与后序遍历序列构造二叉树.mdJava解法
This commit is contained in:
@ -607,6 +607,7 @@ class Solution {
|
|||||||
for (int i = inLeft; i < inRight; i++) {
|
for (int i = inLeft; i < inRight; i++) {
|
||||||
if (inorder[i] == rootVal) {
|
if (inorder[i] == rootVal) {
|
||||||
rootIndex = i;
|
rootIndex = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 根据rootIndex划分左右子树
|
// 根据rootIndex划分左右子树
|
||||||
|
Reference in New Issue
Block a user