Maximize distinct elements and Minimize array cost
Filed under Cashfree
The question
Given two arrays, maximize distinct elements in A after k swaps. Also, find a permutation of array A that minimizes the sum of costs (distinct elements to the left).
No write-up yet. Related questions below have one.
Related Cashfree questions
Collected from public candidate posts and coding forums. Updated Nov 2026.