2020年12月6日

旋转数组的最小数字

摘要: 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。 class Solution { public: //3 4 5 1 2 int minNumberInRota 阅读全文

posted @ 2020-12-06 21:56 wsw_seu 阅读(71) 评论(0) 推荐(0) 编辑

215. Kth Largest Element in an Array(partition逆序排序,index+1 == k)

摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 阅读全文

posted @ 2020-12-06 15:06 wsw_seu 阅读(117) 评论(0) 推荐(0) 编辑

220. Contains Duplicate III(核心:set数组有序/桶排序)

摘要: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and 阅读全文

posted @ 2020-12-06 11:51 wsw_seu 阅读(85) 评论(0) 推荐(0) 编辑

导航