Given a string `s` and an integer `k`, return true if you can use all the characters in `s` to build exactly `k` non-empty palindrome strings, and false otherwise. Each character of `s` must be used exactly once.
Given a string s and an integer k, return true if you can use all the characters in s to build exactly k non-empty palindrome strings, and false otherwise. Each character of s must be used exactly once.
Example 1:
Input: {"s":"annabelle","k":2}
Output: true
Constraints:
1 <= s.length <= 10^5
s consists of lowercase English letters.
1 <= k <= 10^5
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"annabelle","k":2}
We must split 9 letters into exactly 2 non-empty palindromes. First, each palindrome needs at least one letter, so k cannot exceed 9.