From 65bf739ef28c16d9c7e13047af658c1850a46287 Mon Sep 17 00:00:00 2001 From: qiufeihong2018 <15058301288@163.com> Date: Tue, 9 Apr 2024 16:32:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=A0=E6=AD=A3=20target=20=E7=9A=84?= =?UTF-8?q?=E6=8B=BC=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...数组中查找元素的第一个和最后一个位置.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/0034.在排序数组中查找元素的第一个和最后一个位置.md b/problems/0034.在排序数组中查找元素的第一个和最后一个位置.md index 22936fef..9afb9941 100644 --- a/problems/0034.在排序数组中查找元素的第一个和最后一个位置.md +++ b/problems/0034.在排序数组中查找元素的第一个和最后一个位置.md @@ -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