美文网首页Leetcode
【数组-二分】34. Find First and Last P

【数组-二分】34. Find First and Last P

作者: 安琪拉的小迷妹 | 来源:发表于2018-07-26 17:27 被阅读0次

题目链接

https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/description/

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

相关文章

网友评论

    本文标题:【数组-二分】34. Find First and Last P

    本文链接:https://www.haomeiwen.com/subject/hgobmftx.html