1400. Construct K Palindrome Strings Medium
1/**
2 * [1400] Construct K Palindrome Strings
3 *
4 * 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.
5 *
6 * Example 1:
7 *
8 * Input: s = "annabelle", k = 2
9 * Output: true
10 * Explanation: You can construct two palindromes using all characters in s.
11 * Some possible constructions "anna" + "elble", "anbna" + "elle", "anellena" + "b"
12 *
13 * Example 2:
14 *
15 * Input: s = "leetcode", k = 3
16 * Output: false
17 * Explanation: It is impossible to construct 3 palindromes using all the characters of s.
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 * Constraints:
27 *
28 * 1 <= s.length <= 10^5
29 * s consists of lowercase English letters.
30 * 1 <= k <= 10^5
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/construct-k-palindrome-strings/
36// discuss: https://leetcode.com/problems/construct-k-palindrome-strings/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn can_construct(s: String, k: i32) -> bool {
42 false
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_1400() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.