Swift 100%
IntuitionThe goal is to determine if it's possible to construct k palindromes using all characters of the string s. Palindromes have at most one character with
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The goal is to determine if it's possible to construct k palindromes using all characters of the string s. Palindromes have at most one character with an odd frequency (for odd-length palindromes) or all even frequencies (for even-length palindromes). Thus, the key insight is to count the characters with odd frequencies and ensure that there are at most k of them.

# Approach
<!-- Describe your approach to solving the problem. -->
Guard Clause for Basic Check:
- If the length of the string s is less than k, it's impossible to form k palindromes because each palindrome requires at least one character.

Frequency Count:
- Use a hashmap to count the frequency of each character in s.

Count Odd Frequencies:
- Loop through the hashmap and count the number of characters that have an odd frequency. Each odd frequency corresponds to a character that would need to be placed in the middle of a palindrome.

Check Feasibility:
- If the number of odd-frequency characters (count) is less than or equal to k, it's possible to construct k palindromes. Otherwise, it’s not.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(n+m)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(n)

# Code
```swift []
class Solution {
    func canConstruct(_ s: String, _ k: Int) -> Bool {
        var hashMap : [Character : Int] = [:]

        guard s.count >= k else{
            return false
        }

        for ch in s {
            hashMap[ch, default : 0] += 1
        }

        var count = 0
        for (key, value) in hashMap {
            count += (value % 2)
        }

        if count <= k{
            return true
        }else{
            return false
        }
    }
}
```
['Swift']