Find minimum 'difference' of 2 arrays?

We define the ‘difference’ of 2 arrays a and b (with equal length n) are sum of all abs(a[i]-b[i]) with (1<=i<=n). Given 2 arrays a and b, how can we permute a(or b) so that their ‘difference’ are minimized?

1 Like
//