Palindrome
// can we generate palindrome string by suffling
// the character of the string s
public bool CanBePalindrome(string s)
{
var dict = new Dictionary<char, int>();
for (int j =0; j < s.Length; j++)
{
var item = s[j];
if (dict.ContainsKey(item))
{
dict[item]++;
if (dict[item] == 2)
{
dict.Remove(item);
}
}
else
{
dict.Add(item, 1);
}
}
return dict.Count <= 1;
}
PrashantUnity