1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最少移动次数使数组元素相等 II [minimum-moves-to-equal-array-elements-ii].html
2022-03-29 12:43:11 +08:00

17 lines
479 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个非空整数数组找到使所有数组元素相等所需的最小移动数其中每次移动可将选定的一个元素加1或减1。 您可以假设数组的长度最多为10000。</p>
<p><strong>例如:</strong></p>
<pre>
<strong>输入:</strong>
[1,2,3]
<strong>输出:</strong>
2
<strong>说明:
</strong>只有两个动作是必要的记得每一步仅可使其中一个元素加1或减1
[1,2,3] =&gt; [2,2,3] =&gt; [2,2,2]
</pre>