1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-26 02:00:27 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/二倍数对数组 [array-of-doubled-pairs].html

36 lines
1.0 KiB
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p>给定一个长度为偶数的整数数组 <code>arr</code>,只有对 <code>arr</code> 进行重组后可以满足 “对于每个 <code>0 &lt;=&nbsp;i &lt; len(arr) / 2</code>,都有 <code>arr[2 * i + 1] = 2 * arr[2 * i]</code>&nbsp;时,返回 <code>true</code>;否则,返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>arr = [3,1,3,6]
<strong>输出:</strong>false
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>arr = [2,1,2,6]
<strong>输出:</strong>false
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>arr = [4,-2,2,-4]
<strong>输出:</strong>true
<strong>解释:</strong>可以用 [-2,-4] 和 [2,4] 这两组组成 [-2,-4,2,4] 或是 [2,4,-2,-4]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= arr.length &lt;= 3 * 10<sup>4</sup></code></li>
<li><code>arr.length</code> 是偶数</li>
<li><code>-10<sup>5</sup> &lt;= arr[i] &lt;= 10<sup>5</sup></code></li>
</ul>