Given an array, find the number n so that the sum of the absolute value of each elements in the array when subtract for n is minimum

后端 未结 0 377
礼貌的吻别
礼貌的吻别 2020-12-06 16:54

Condition is that ai <= 10^9 .Im thinking of a brute force approach where i test every n form 1 to 10^9, but it would be way too heavy to run, are there any other way to

相关标签:
回答
  • 消灭零回复
提交回复
热议问题