LC: 280. Wiggle Sort
https://leetcode.com/problems/wiggle-sort/
Input: nums = [3,5,2,1,6,4]
Output: [3,5,1,6,2,4]
Explanation: [1,6,2,5,3,4] is also accepted.Input: nums = [6,6,5,6,3,8]
Output: [6,6,5,6,3,8]Last updated
https://leetcode.com/problems/wiggle-sort/
Input: nums = [3,5,2,1,6,4]
Output: [3,5,1,6,2,4]
Explanation: [1,6,2,5,3,4] is also accepted.Input: nums = [6,6,5,6,3,8]
Output: [6,6,5,6,3,8]Last updated
if (index is odd) == (arr[i] < arr[i+1]):
switch with next elementclass Solution {
public void wiggleSort(int[] nums) {
}
}