Merge pull request #2107 from zou-weidong/patch-1

Update 0034.在排序数组中查找元素的第一个和最后一个位置.md
This commit is contained in:
程序员Carl 2023-06-14 09:15:20 +08:00 committed by GitHub
commit 882463bbae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -240,7 +240,7 @@ class Solution {
while (left - 1 >= 0 && nums[left - 1] == nums[index]) { // 防止数组越界。逻辑短路,两个条件顺序不能换
left--;
}
// 向滑动,找右边界
// 向滑动,找右边界
while (right + 1 < nums.length && nums[right + 1] == nums[index]) { // 防止数组越界
right++;
}