Rearrange an array such that every element at an odd index is greater than its neighbors, or follow a specific alternating pattern (e.g., small, large, small, large).
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.