
sort
萤火虫啊飞呀飞
这个作者很懒,什么都没留下…
展开
-
排序LeetCode 767 Reorganize String
LeetCode 767Reorganize StringProblem Description: 对字符串中的字符顺序进行调整,如果能够使相邻字符不相同,返回调整后的任一满足字符串,否则返回空字符串。 具体的题目信息: https://leetcode.com/problems/reorganize-string/description/Example: Solution:...原创 2018-06-20 20:55:53 · 198 阅读 · 0 评论 -
排序LeetCode 215 Kth Largest Element in an Array
LeetCode 215Kth Largest Element in an ArrayProblem Description: 返回数组的第k大元素,可采用快速排序的方法。快速排序每遍历一次就确定一个元素在数组中的最终位置,比该元素大的位于该元素右侧,比该元素小的位于该元素左侧。通过每次遍历后比较确定的位置和k 值大小,缩小区间范围,最终即可求出第k大元素。 具体的题目信息: ht...原创 2018-06-21 08:34:34 · 133 阅读 · 0 评论 -
排序LeetCode 347 Top K Frequent Elements
LeetCode 347Top K Frequent ElementsProblem Description: 返回数组出现频率最高的前k个元素(若从1开始计数,包含第k个)。 具体的题目信息: https://leetcode.com/problems/top-k-frequent-elements/description/Example: Given [1,1,1,2,2,...原创 2018-06-21 09:03:03 · 159 阅读 · 0 评论 -
排序LeetCode 451 Sort Characters By Frequency
LeetCode 451Sort Characters By FrequencyProblem Description: 根据字符串中每个字符出现频率从高到低组成新的字符串。 具体的题目信息: https://leetcode.com/problems/sort-characters-by-frequency/description/Example: Solution:...原创 2018-06-21 09:14:44 · 123 阅读 · 0 评论 -
Leetcode 31 Next Permutation
Leetcode 31Next PermutationProblem Description: 返回给出数字序列的下一个序列(数字序列按升序排列,若给出的序列是最后一个,则返回第一个数字序列) 具体的题目信息: https://leetcode.com/problems/next-permutation/description/Example: 以序列< 6 5 4 8 ...原创 2018-06-24 13:49:00 · 367 阅读 · 0 评论 -
排序LeetCode 56 Merge Intervals
LeetCode 56Merge IntervalsProblem Description: 合并所有的重叠区间。 具体的题目信息: https://leetcode.com/problems/merge-intervals/description/Example: Solution: 解题思路:题目实际考查重叠区间的求法,我们定义一个比较函数将所有的区间按照左区间大小从...原创 2018-06-20 09:25:40 · 245 阅读 · 0 评论 -
排序LeetCode 324 Wiggle Sort II
LeetCode 324Wiggle Sort IIProblem Description: 将一个数组进行摆动排序,即满足num[0]<num[1]>num[2]<num[3].... 具体的题目信息: https://leetcode.com/problems/wiggle-sort-ii/description/Example: Solution: ...原创 2018-06-20 13:23:28 · 341 阅读 · 0 评论 -
LeetCode 274 H-Index
LeetCode 274H-IndexProblem Description: h-index又称为h指数或h因子(h-factor),是一种评价学术成就的新方法。h代表“高引用次数”(high citations),一名科研人员的h指数是指他至多有h篇论文分别被引用了至少h次。题目给出一个数组,求出对应的h-index。 具体的题目信息: https://leetcode.com...原创 2018-06-20 15:22:05 · 2444 阅读 · 0 评论 -
LeetCode 57 Insert Interval
LeetCode 57Insert IntervalProblem Description: 给出一串不重叠区间,将一个新的区间插入到这些不重叠区间中,如果该新区间与原区间数组有重叠,要对区间进行合并处理。 具体的题目信息: https://leetcode.com/problems/insert-interval/description/Example: Solution:...原创 2018-06-20 17:20:04 · 115 阅读 · 0 评论