File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
1400-ConstructKPalindromeStrings Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ Given a string s and an integer k, return true if you can use all the characters in s to construct k palindrome strings or false otherwise.
2
+
3
+
4
+ Example 1:
5
+
6
+ Input: s = "annabelle", k = 2
7
+ Output: true
8
+ Explanation: You can construct two palindromes using all characters in s.
9
+ Some possible constructions "anna" + "elble", "anbna" + "elle", "anellena" + "b"
10
+
11
+
12
+ Example 2:
13
+
14
+ Input: s = "leetcode", k = 3
15
+ Output: false
16
+ Explanation: It is impossible to construct 3 palindromes using all the characters of s.
17
+
18
+
19
+ Example 3:
20
+
21
+ Input: s = "true", k = 4
22
+ Output: true
23
+ Explanation: The only possible solution is to put each character in a separate string.
24
+
25
+
26
+
27
+ Constraints:
28
+
29
+
30
+ 1 <= s.length <= 105
31
+ s consists of lowercase English letters.
32
+ 1 <= k <= 105
33
+
You can’t perform that action at this time.
0 commit comments