InterviewDB Question

Minimize Absolute Differences - Pair Elements to Minimize Total Absolute Difference

Question Details

Problem Given two arrays A and B of equal length n, pair each element of A with exactly one element of B (bijection). Minimize the total sum of absolute differences: sum(|A[i] - B[perm[i]]|). Return the minimum total sum. Example Proof sketch: sortin…

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Coding Oa