Search
⌘K

Leetcode 2164. Sort Even and Odd Indices Independently

Rearrange the array by sorting elements at even indices in non-decreasing order and elements at odd indices in non-increasing order, then placing the sorted values back into their original parity positions. Return the resulting array.

Asked at:

Meta


Question Timeline

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

Late November, 2024

Meta

Junior

Sort numbers based on whether they are odd or even

Comments

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