![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode刷题
不知白鹭
我已经怒不可遏了!
展开
-
LeetCode 题解 数组 2.1.4 在旋转排序数组中搜索Ⅱ
LeetCode 题解 2.1 数组 2.1.4 Search in Rotated Sorted ArrayⅡ 2.1.4 在旋转排序数组中搜索 题目描述 后续“在旋转排序数组中搜索”:如果允许重复怎么办? 这会影响运行时复杂度吗?如何以及为什么? 写一个函数来确定给定的目标是否在数组中。 代码思路: 要是允许有重复的元素,则可能会出现 [1,2,3,1,1,1] 这样的情况,这时候之前的判断条件,拿中间数和两边相比较,就有可能出现相等的情况,无法判断这一区间是否递增,这时就要特殊情况特殊判断,改变判断条原创 2021-05-12 21:34:12 · 97 阅读 · 0 评论 -
LeetCode 题解 数组 2.1.3在旋转排序数组中搜索
LeetCode 题解 2.1 数组 2.1.3 Search in Rotated Sorted Array 2.1.3 在旋转排序数组中搜索 题目描述 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in t原创 2021-05-11 00:15:45 · 78 阅读 · 0 评论 -
LeetCode 题解 数组 2.1.2从排序数组中删除重复项 Ⅱ
LeetCode 题解 2.1 数组 2.1.2 Remove Duplicates from Sorted Array Ⅱ 2.1.2从排序数组中删除重复项 Ⅱ Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3], Your function should return length = 5, an原创 2021-05-10 17:52:04 · 73 阅读 · 0 评论 -
LeetCode 题解 数组 2.1.1从排序数组中删除重复项
LeetCode 题解 2.1 数组 2.1.1 Remove Duplicates from Sorted Array 2.1.1从排序数组中删除重复项 描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must原创 2021-05-10 17:24:36 · 122 阅读 · 0 评论