Available question text
Given an array of distinct integers, find the minimum number of adjacent swaps to reorder it so parities alternate (even/odd/even/...), or return -1 if impossible. Key insight: feasibility requires the counts of evens and odds to differ by at most one, and the min swaps equals the minimal total displacement when matching current indices of one parity to target positions (try both starting-parity patterns).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3587. Minimum Adjacent Swaps to Alternate Parity
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source