You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Given a string <code>s</code> and an integer <code>k</code>, return <code>true</code> <em>if you can use all the characters in </em><code>s</code><em> to construct </em><code>k</code><em> palindrome strings or </em><code>false</code><em> otherwise</em>.</p>
2
+
3
+
<p> </p>
4
+
<p><strongclass="example">Example 1:</strong></p>
5
+
6
+
<pre>
7
+
<strong>Input:</strong> s = "annabelle", k = 2
8
+
<strong>Output:</strong> true
9
+
<strong>Explanation:</strong> You can construct two palindromes using all characters in s.
10
+
Some possible constructions "anna" + "elble", "anbna" + "elle", "anellena" + "b"
11
+
</pre>
12
+
13
+
<p><strongclass="example">Example 2:</strong></p>
14
+
15
+
<pre>
16
+
<strong>Input:</strong> s = "leetcode", k = 3
17
+
<strong>Output:</strong> false
18
+
<strong>Explanation:</strong> It is impossible to construct 3 palindromes using all the characters of s.
19
+
</pre>
20
+
21
+
<p><strongclass="example">Example 3:</strong></p>
22
+
23
+
<pre>
24
+
<strong>Input:</strong> s = "true", k = 4
25
+
<strong>Output:</strong> true
26
+
<strong>Explanation:</strong> The only possible solution is to put each character in a separate string.
0 commit comments