Suppose we have 5 arrays A, B, C, D, E each of size N. Now we need to find the
max(|A[i] - A[j]| + |B[i] - B[j]| + |C[i] - C[j]| + |D[i] - D[j]| + |E[i] - E[j]| + |i - j|) where 1<=i<j<=N.
I'm well aware of the problem to find max(|A[i] - A[j]| + |i - j|) for a single array in O(n). But its solution method doesn't seem to be applicable in this case.
So my question is how to solve this problem in O(nlogn) runtime or if possible O(n) runtime.