🔥Explanations No One Will Give You🎓🧠 Very Easy C++ Solution✅✨ 🚀Beats 💯 %  on LeetCode🚀🎉!!
IntuitionFirst of all on reading the question, I noticed a few conditions for getting a palindrome like the smallest palindrome string can be a letter itself an
# Intuition
First of all on reading the question, I noticed a few conditions for getting a palindrome like the smallest palindrome string can be a letter itself and the letter at the middle of the palindrome string is having an odd frequency always. Now keeping these conditions in mind I tried to code the solution to the problem.

![image.png](https://assets.leetcode.com/users/images/3fb8c999-a9ce-433d-a4d2-9d605deebee4_1736604510.485258.png)


# Approach
- Create a variable named `n` where `n=s.size()`.
- Now, `if(n==k)` return `true` as at max we can make n palindrome strings of single character.
- `if(n<k)` then return false.
- Now, create a `freq` array to keep a track of the frequency of each character in the given string `s`.
- Then create a counter variable to count characters with odd frequency, i.e `cnt_odd=0`.
- Now, traverse through the `freq` array and in each iteration increment `cnt_odd` if the the frequency is odd and also check that `if (cnt_odd>k)` then return `false`.
- Finally, return `true`. 

# Complexity
- **Time complexity:** O(N)⏳

- **Space complexity:** O(1)🚀

# Code
```cpp []
class Solution {
public:
    bool canConstruct(string s, int k) {
        int n=s.size();
        if(n==k) return true;
        if(n<k) return false;
        int freq[26]={0};
        for(auto x: s) ++freq[x-'a'];
        int cnt_odd=0;
        for(int i=0; i<26; ++i){
            cnt_odd+=(freq[i]&1);
            if(cnt_odd>k) return false;
        }
        return true;
    }
};
auto init=[](){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    return 0;
}();
```
['C++']