Pick k numbers with minimal sum of value differences


  • 0
    T

    You are given an positive integer array of size n, your task is to pick k numbers out of this array, with minimal sum of absolute value differences. You only need to output such a minimal value.

    Say your picked k values are (X1, X2, .. Xk), We define the sum of its value differences as below:

    sum of abs(Xi - Xj) where 1<=i<j<=k.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.