【数组-二分】34. Find First and Last P
2018-07-26 本文已影响0人
安琪拉的小迷妹
题目链接
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/description/

思路:复杂度是log,用二分。当nums[mid]==target的时候,用for循环来判断左右边界。

题目链接
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/description/
思路:复杂度是log,用二分。当nums[mid]==target的时候,用for循环来判断左右边界。