Simple Java Solution - Using HashMap
Complexity

Time complexity:
O(n), where n = s.length()


Space complexity:
O(n), where n = s.length()

Code
# Complexity
- Time complexity:
$$O(n)$$, where n = s.length()

- Space complexity:
$$O(n)$$, where n = s.length()

# Code
```java []
class Solution {
    public boolean canConstruct(String s, int k) {
        if(s.length() < k) {
            return false;
        }
        HashMap<Character, Integer> map = new HashMap<>();
        for(char ch: s.toCharArray()) {
            map.put(ch, map.getOrDefault(ch,0)+1);
        }
        int oddCount = 0;
        for(char ch: map.keySet()) {
            if(map.get(ch) % 2 != 0) {
                oddCount++;
            }
            if(oddCount > k) {
                return false;
            }
        }
        return true;
    }
}
```
['Java']