bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumArrays & HashingLC 280

Wiggle Sort

Given an integer array nums, reorder it such that nums[0] = nums[2] <= nums[3].... You may assume the input array always has a valid answer.

Asked at 5 companies
AirbnbAmazonFacebook
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode