title: Minimize Sum of Absolute Difference of Two Arrays
body: <p>I have two arrays of integers <code>A</code> and <code>B</code> both of size <code>n</code>. The cost of a pair is <code>|A(i) - B(i)|</code>.<br />
  I want to pair the n elements of A and B such that the sum of all costs across all <code>A(i)</code>s and <code>B(i)</code>s are minimized.</p>
  <p>I understand that I can get <code>O(n log n)</code> by sorting <code>A</code>, then sorting <code>B</code>, and then pairing them together from <code>1...n</code> respectively, but after attempting for hours and hours, I can't figure out how to prove it. Can somebody help me out?</p>
  <p>I've seen how to implement it, I just don't get how to prove it</p>