Search
⌘K

Leetcode 905. Sort Array By Parity

Partition the array so that all even numbers appear before all odd numbers, returning any arrangement that satisfies this; order within the even/odd groups doesn't matter. This is a straightforward in-place partitioning problem (O(n) time, constant extra space possible) over up to 5000 elements.

Asked at:

Meta


Question Timeline

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

Mid January, 2025

Meta

Mid-level

segregate even and odd integers in a list to left and right side in place

Comments

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