mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
28 lines
778 B
HTML
28 lines
778 B
HTML
<p>给你一个 <strong>只包含正整数 </strong>的 <strong>非空 </strong>数组 <code>nums</code> 。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [1,5,11,5]
|
||
<strong>输出:</strong>true
|
||
<strong>解释:</strong>数组可以分割成 [1, 5, 5] 和 [11] 。</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [1,2,3,5]
|
||
<strong>输出:</strong>false
|
||
<strong>解释:</strong>数组不能分割成两个元素和相等的子集。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 200</code></li>
|
||
<li><code>1 <= nums[i] <= 100</code></li>
|
||
</ul>
|