Merge pull request #2519 from awsome-knowledge/master

fix: 纠正 target 的拼写
This commit is contained in:
程序员Carl
2024-04-10 10:38:01 +08:00
committed by GitHub

View File

@ -233,7 +233,7 @@ class Solution {
if (index == -1) { // nums 中不存在 target直接返回 {-1, -1}
return new int[] {-1, -1}; // 匿名数组
}
// nums 中存在 targe则左右滑动指针来找到符合题意的区间
// nums 中存在 target,则左右滑动指针,来找到符合题意的区间
int left = index;
int right = index;
// 向左滑动,找左边界
@ -450,7 +450,7 @@ class Solution:
return -1
index = binarySearch(nums, target)
if index == -1:return [-1, -1] # nums 中不存在 target直接返回 {-1, -1}
# nums 中存在 targe则左右滑动指针来找到符合题意的区间
# nums 中存在 target,则左右滑动指针,来找到符合题意的区间
left, right = index, index
# 向左滑动,找左边界
while left -1 >=0 and nums[left - 1] == target: left -=1