Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2561. Rearranging Fruits
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.