
#排序
fantow
这个作者很懒,什么都没留下…
展开
-
LeetCode题解 -- 排序(179)
Largest Number Given a list of non negative integers, arrange them such that they form the largest number. 时间复杂度:O(n^2) 空间复杂度:O(n) public String largestNumber(int[] nums) { int length = nums.l...原创 2020-03-07 23:23:48 · 129 阅读 · 0 评论 -
LeetCode题解 -- 排序(324)
Wiggle Sort II Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]… 时间复杂度:O(n*logn) 空间复杂度:O(n) 将排序后的数组分为前后两部分,每次从两部分中拿出当前最大的,按顺序放入temp数组 public void wiggl...原创 2020-03-07 21:29:52 · 119 阅读 · 0 评论 -
LeetCode题解 -- 排序(75)
Sort Colors Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will...原创 2020-03-07 20:20:10 · 132 阅读 · 0 评论