Available question text
Given two equal-length arrays, you can swap elements between them at cost min(a,b); determine the minimum total cost to make their sorted multisets identical or return -1 if impossible. The core challenge is to check parity of combined frequencies and optimally pair surplus values using direct swaps or cheaper two-step swaps via the global minimum to minimize cost.
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 2561. Rearranging Fruits
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source