代码拉取完成,页面将自动刷新
<p>You are given an integer array <code>nums</code> consisting of <code>2 * n</code> integers.</p>
<p>You need to divide <code>nums</code> into <code>n</code> pairs such that:</p>
<ul>
<li>Each element belongs to <strong>exactly one</strong> pair.</li>
<li>The elements present in a pair are <strong>equal</strong>.</li>
</ul>
<p>Return <code>true</code> <em>if nums can be divided into</em> <code>n</code> <em>pairs, otherwise return</em> <code>false</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [3,2,3,2,2,2]
<strong>Output:</strong> true
<strong>Explanation:</strong>
There are 6 elements in nums, so they should be divided into 6 / 2 = 3 pairs.
If nums is divided into the pairs (2, 2), (3, 3), and (2, 2), it will satisfy all the conditions.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,2,3,4]
<strong>Output:</strong> false
<strong>Explanation:</strong>
There is no way to divide nums into 4 / 2 = 2 pairs such that the pairs satisfy every condition.
</pre>
<p> </p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>nums.length == 2 * n</code></li>
<li><code>1 <= n <= 500</code></li>
<li><code>1 <= nums[i] <= 500</code></li>
</ul>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。