Description
Given an unsorted array nums
, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]...
.
Example:
1 | Input: nums = [3,5,2,1,6,4] |
https://leetcode.com/problems/wiggle-sort/description/
Solution
1 | class Solution { |
Why don't you come to your senses?
Given an unsorted array nums
, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]...
.
Example:
1 | Input: nums = [3,5,2,1,6,4] |
https://leetcode.com/problems/wiggle-sort/description/
1 | class Solution { |