Skip to content

Commit f95c3c3

Browse files
refactor 324
1 parent 1ae4ab9 commit f95c3c3

File tree

1 file changed

+3
-16
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-16
lines changed

src/main/java/com/fishercoder/solutions/_324.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,12 @@
33
import java.util.Collections;
44
import java.util.PriorityQueue;
55

6-
/**
7-
* 324. Wiggle Sort II
8-
*
9-
* Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....
10-
11-
Example:
12-
(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6].
13-
(2) Given nums = [1, 3, 2, 2, 3, 1], one possible answer is [2, 3, 1, 3, 1, 2].
14-
15-
Note:
16-
You may assume all input has valid answer.
17-
18-
Follow Up:
19-
Can you do it in O(n) time and/or in-place with O(1) extra space?
20-
*/
216
public class _324 {
227

238
public static class Solution1 {
24-
/** Credit: https://discuss.leetcode.com/topic/41464/step-by-step-explanation-of-index-mapping-in-java */
9+
/**
10+
* Credit: https://discuss.leetcode.com/topic/41464/step-by-step-explanation-of-index-mapping-in-java
11+
*/
2512
public void wiggleSort(int[] nums) {
2613
int median = findKthLargest(nums, (nums.length + 1) / 2);
2714
int n = nums.length;

0 commit comments

Comments
 (0)