diff --git a/notes/剑指 offer 题解.md b/notes/剑指 offer 题解.md index c0c5412f..0dd2ea24 100644 --- a/notes/剑指 offer 题解.md +++ b/notes/剑指 offer 题解.md @@ -1532,10 +1532,10 @@ private boolean verify(int[] sequence, int first, int last) return true; int rootVal = sequence[last]; int cutIndex = first; - while (cutIndex < last && sequence[cutIndex] <= rootVal) + while (cutIndex < last && sequence[cutIndex] > rootVal) cutIndex++; for (int i = cutIndex + 1; i < last; i++) - if (sequence[i] < rootVal) + if (sequence[i] > rootVal) return false; return verify(sequence, first, cutIndex - 1) && verify(sequence, cutIndex, last - 1); }