Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions epi_judge_java_solutions/epi/IsTreeBalanced.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public static boolean isBalanced(BinaryTreeNode<Integer> tree) {
}

BalanceStatusWithHeight leftResult = checkBalanced(tree.left);
if (!leftResult.balanced) {
return leftResult;
// if (!leftResult.balanced) { // not used condition , state unreachable ,always true
// return leftResult;
}
BalanceStatusWithHeight rightResult = checkBalanced(tree.right);
if (!rightResult.balanced) {
return rightResult;
//if (!rightResult.balanced) { // not used condition , state unreachable ,always true
//return rightResult;
}

boolean isBalanced = Math.abs(leftResult.height - rightResult.height) <= 1;
Expand Down