"https://leetcode.com/problems/search in rotated sorted array/" 对于一个有序数组,将其元素以某一个元素为轴进行旋转,比如[0,1,2,3,4,5,6,7]可能会变成[4,5,6,7,0,1,2,3] 求这个经过旋转的数组中是否存在有值等 ...
分类:
其他好文 时间:
2020-03-19 23:14:24
阅读次数:
106
原题链接在这里:https://leetcode.com/problems/rotated-digits/ 题目: X is a good number if after rotating each digit individually by 180 degrees, we get a valid ...
分类:
其他好文 时间:
2019-12-27 09:49:53
阅读次数:
54
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。 搜索一个给定的 ...
分类:
编程语言 时间:
2019-12-25 01:40:40
阅读次数:
81
81. Search in Rotated Sorted Array II 如果中间的数小于最右边的数,则右半段是有序的,若中间数大于最右边数,则左半段是有序的。而如果可以有重复值,就会出现来面两种情况,[3 1 1] 和 [1 1 3 1],对于这两种情况中间值等于最右值时,目标值3既可以在左边又 ...
分类:
其他好文 时间:
2019-12-11 13:14:34
阅读次数:
92
154. Find Minimum in Rotated Sorted Array II 当数组中存在大量的重复数字时,就会破坏二分查找法的机制,将无法取得 O(lgn) 的时间复杂度,又将会回到简单粗暴的 O(n),比如这两种情况:{2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, ...
分类:
其他好文 时间:
2019-11-25 00:10:21
阅读次数:
72
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog ...
分类:
其他好文 时间:
2019-11-24 10:19:47
阅读次数:
56
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are o ...
分类:
其他好文 时间:
2019-11-24 09:33:35
阅读次数:
65
在旋转有序数组中搜索二。这题跟[LeetCode] 33. Search in Rotated Sorted Array求的一样,多一个条件是input里面有重复数字。依然是用二分法做,但是worst case很可能会到O(n);而且其中还会多一个case的判断,就是nums[mid]和nums[s ...
分类:
其他好文 时间:
2019-11-05 01:18:45
阅读次数:
85
Medium Suppose an array sorted in ascending order 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 ...
分类:
其他好文 时间:
2019-10-31 13:38:02
阅读次数:
87
问题:https://leetcode-cn.com/problems/search-in-rotated-sorted-array/submissions/ GitHub实现:https://github.com/JonathanZxxxx/LeetCode/blob/master/Class33 ...
分类:
编程语言 时间:
2019-10-23 14:00:06
阅读次数:
117