- 博客(4)
- 收藏
- 关注
原创 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
152
原创 LeetCode 题解 数组 2.1.3在旋转排序数组中搜索
LeetCode 题解2.1 数组2.1.3 Search in Rotated Sorted Array2.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
132
原创 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
120
原创 LeetCode 题解 数组 2.1.1从排序数组中删除重复项
LeetCode 题解2.1 数组2.1.1 Remove Duplicates from Sorted Array2.1.1从排序数组中删除重复项描述Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for another array, you must
2021-05-10 17:24:36
174
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅