
二分查找
码不停Ti
信息安全在校大学生
展开
-
33. 搜索旋转排序数组
假设按照升序排序的数组在预先未知的某个点上进行了旋转。( 例如,数组[0,1,2,4,5,6,7]可能变为[4,5,6,7,0,1,2])。搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回-1。你可以假设数组中不存在重复的元素。你的算法时间复杂度必须是O(logn) 级别。示例 1:输入: nums = [4,5,6,7,0,1,2]...原创 2019-12-06 21:04:42 · 322 阅读 · 0 评论 -
【LeetCode】4. Median of Two Sorted Arrays
英文原题There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1...原创 2019-09-27 00:20:08 · 389 阅读 · 0 评论