Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Rearrange an integer array so all even numbers appear before odd numbers.
Return the minimum number of swaps required to achieve this partition.
The relative order within each parity group does not matter.
What This Tests
Array partitioning and logical reasoning
Greedy mathematical insight for optimization
Parity checks and boundary condition handling
Complexity analysis under large input constraints
Common Patterns
Two Pointers
Greedy
Sliding Window
Collapse
Hint
What Interviewers May Ask Next
Report
Report seen similar question in interview
Accepted
1.5k
/1.9k
Acceptance Rate
77.8%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Python3
Auto
Debug
Run
Submit
Test Cases
Input
nums =
Output
Expected