[
palindrome
anagram
counter
]
BinarySearch 0161 Palindromic Anagram
Problem statement
https://binarysearch.com/problems/Palindromic-Anagram/
Solution
All we need to do is to counte elements and we can have only one of them with odd frequency.
Complexity
It is O(n)
for time and O(26)
for space.
Code
class Solution:
def solve(self, s):
return sum(i%2 == 1 for i in Counter(s).values()) <= 1