280. Wiggle Sort

The idea of this solution is pretty simple. We sort nums and then keep switching the numbers, so we get the array wiggled.

func wiggleSort(nums []int)  {
    sort.Ints(nums)
    for i := 1; i < len(nums) - 1; i += 2 {
        nums[i], nums[i + 1] = nums[i + 1], nums[i]
    }
}