Given an unsorted array, reorder it so that nums[0] < nums[1] > nums[2] < nums[3] ... . The bounded-value and frequency structure makes counting-style placement useful for this rearrangement problem.
nums = array of integers
nums rearranged into wiggle order
Example 1:
Input:
nums = [1,5,1,1,6,4]
Output:
[1,6,1,5,1,4]
Explanation:
One valid wiggle arrangement alternates low and high values.
Example 2:
Input:
nums = [1,3,2,2,3,1]
Output:
[2,3,1,3,1,2]
Explanation:
The result alternates smaller and larger values.