Search
⌘K

Leetcode 280. Wiggle Sort

Reorder an unsorted array in-place into a wiggle sequence such that nums[0] < nums[1] > nums[2] < nums[3] ... (or any equivalent alternating < and > pattern). The challenge is to handle duplicates and produce any valid arrangement efficiently, typically requiring median-based partitioning and careful indexing to achieve linear time and constant extra space.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.