1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/划分为k个相等的子集 [partition-to-k-equal-sum-subsets].html
2022-03-29 12:43:11 +08:00

27 lines
835 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>给定一个整数数组&nbsp;&nbsp;<code>nums</code> 和一个正整数 <code>k</code>,找出是否有可能把这个数组分成 <code>k</code> 个非空子集,其总和都相等。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> nums = [4, 3, 2, 3, 5, 2, 1], k = 4
<strong>输出:</strong> True
<strong>说明:</strong> 有可能将其分成 4 个子集51,42,32,3等于总和。</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> nums = [1,2,3,4], k = 3
<strong>输出:</strong> false</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= k &lt;= len(nums) &lt;= 16</code></li>
<li><code>0 &lt; nums[i] &lt; 10000</code></li>
<li>每个元素的频率在 <code>[1,4]</code> 范围内</li>
</ul>