mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-12 08:55:14 +08:00
41 lines
1.5 KiB
HTML
41 lines
1.5 KiB
HTML
<p>给你一个字符串 <code>s</code> 和一个整数 <code>k</code> 。请你用 <code>s</code> 字符串中 <strong>所有字符</strong> 构造 <code>k</code> 个<strong>非空</strong> <span data-keyword="palindrome-string">回文串</span> 。</p>
|
||
|
||
<p>如果你可以用 <code>s</code> 中所有字符构造 <code>k</code> 个回文字符串,那么请你返回 <strong>True</strong> ,否则返回 <strong>False</strong> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>s = "annabelle", k = 2
|
||
<strong>输出:</strong>true
|
||
<strong>解释:</strong>可以用 s 中所有字符构造 2 个回文字符串。
|
||
一些可行的构造方案包括:"anna" + "elble","anbna" + "elle","anellena" + "b"
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>s = "leetcode", k = 3
|
||
<strong>输出:</strong>false
|
||
<strong>解释:</strong>无法用 s 中所有字符构造 3 个回文串。
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>s = "true", k = 4
|
||
<strong>输出:</strong>true
|
||
<strong>解释:</strong>唯一可行的方案是让 s 中每个字符单独构成一个字符串。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
|
||
<li><code>s</code> 中所有字符都是小写英文字母。</li>
|
||
<li><code>1 <= k <= 10<sup>5</sup></code></li>
|
||
</ul>
|