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)/分割等和子集 [partition-equal-subset-sum].html

28 lines
778 B
HTML
Raw Normal View History

2022-03-27 20:52:13 +08:00
<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>