[java/Python 3] Count odd occurrences - 2 codes w/ brief explanation and analysis.
Explanation of the method - credit to @lionkingeatapple\nIf we need to construct k palindromes, and each palindrome at most has1 character with odd times of occ
**Explanation of the method** - credit to **@lionkingeatapple**\nIf we need to construct `k` palindromes, and each palindrome at most has`1` character with odd times of occurrence. The oddest times of occurrence we can have is `1 * k = k`. Therefore, `oddNum <= k`. And it is impossible to construct `k` palindromes when the input string s\'s length is less than `k`. So we can conclude that in order to construct `k` palindromes it must satisfy the condition `oddNum <= k` && `k <= s.length()`.\n\n----\n\n1. Each palindrome at most has one character with odd times of occurrence;\n2. `Non-empty` means each  palindrome at least has one character, hence `k <= s.length()`.\n\n**Method 1:**\n```java\n    public boolean canConstruct(String s, int k) {\n        int[] count = new int[26];\n        for (int i = 0; i < s.length(); ++i) {\n            ++count[s.charAt(i) - \'a\'];\n        }\n        int oddNum = 0;\n        for (int i = 0; i < 26; ++i) {\n            oddNum += count[i] % 2;\n        }\n        return oddNum <= k && k <= s.length();\n    }\n```\nOr make the above 2 for loops as 1:\n```java\n    public boolean canConstruct(String s, int k) {\n        int[] count = new int[26];\n        int oddNum = 0;\n        for (int i = 0; i < s.length(); ++i) {\n            oddNum += ++count[s.charAt(i) - \'a\'] % 2 == 0 ? -1 : 1;\n        }\n        return oddNum <= k && k <= s.length();\n    }\n```\n```python\n    def canConstruct(self, s: str, k: int) -> bool:\n        return sum(v % 2 for v in collections.Counter(s).values()) <= k <= len(s)\n```\n\n----\n\n**Method 2:**\nOr use bit manipulation:\n```java\n    public boolean canConstruct(String s, int k) {\n        int odd = 0;\n        for (int i = 0; i < s.length(); ++i) {\n            odd ^= 1 << (s.charAt(i) - \'a\');\n        }\n        return Integer.bitCount(odd) <= k && k <= s.length();\n    }\n```\n```python\n    def canConstruct(self, s: str, k: int) -> bool:\n        odd = 0\n        for c in s:\n            odd ^= 1 << (ord(c) - ord(\'a\'))\n        return bin(odd).count(\'1\') <= k <= len(s)\n```\n\n**Analysis:**\nTime: O(n), space: O(1), where n = s.length().
[]