MInimize SUM(|x — A[i]|*B[i]), i >= 0 and i < N, B[i] > 0

Revision en1, by Aafat_Wapas, 2019-07-31 13:01:42

How To Find the minimum value of the expression below:

SUM(|x - A[i]|*B[i]), i >= 0 and i < N, B[i] > 0

When B[i] = 1 I know the answer is given by x = Median(A).How to calculate x when B itself varies.

Tags #math, #sorting, #dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Aafat_Wapas 2019-07-31 13:01:42 272 Initial revision (published)