Halloween SalePremium questions, over 30% offUnlock all premium questions for over 30% off
Evens Before Odds
Medium
You are given an integer array nums. Rearrange nums so that all even numbers appear before all odd numbers. The relative order of even or odd numbers among themselves does not matter.
Return the minimum number of swaps needed to achieve this arrangement. A single swap exchanges the values at any two distinct indices. If the array is already arranged with all evens before all odds, return 0. ...
More Microsoft interview questions
- Best Window For Target Countmedium
- Digit Replacement Maximizermedium
- Combine N-ary Treeshard
- Bounded Repeat Substringmedium
- Non-Adjacent Team Selectionhard
- Rate Limiterhard
- Shortest Substring with N Unique Charactersmedium
- Object Oriented Design - Notification Servicemedium
OfferRetriever
Master technical interviews with real questions from top companies. Build your confidence and career.
LEGAL
© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.