
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Given the character counts, under what conditions can a palindrome be formed ?
From left to right, use bitwise xor-operation to compute for any prefix the number of times modulo 2 of each digit. (mask ^= (1<<(s[i]-'0')).
Expected complexity is O(n*A) where A is the alphabet (10).