34.在排序数组中查找元素的第一个和最后一个位置,Java版本解法2注释修改

This commit is contained in:
posper
2021-08-01 11:20:13 +08:00
parent 5d1c088307
commit 7757a60d0e

View File

@ -223,7 +223,7 @@ class Solution {
// 解法2
// 1、首先在 nums 数组中二分查找 target
// 2、如果二分查找失败则 binarySearch 返回 -1表明 nums 中没有 target。此时searchRange 直接返回 {-1, -1}
// 3、如果二分查找失败,则 binarySearch 返回 nums 中 为 target 的一个下标。然后,通过左右滑动指针,来找到符合题意的区间
// 3、如果二分查找成功,则 binarySearch 返回 nums 中为 target 的一个下标。然后,通过左右滑动指针,来找到符合题意的区间
class Solution {
public int[] searchRange(int[] nums, int target) {