public static bool Checkv1(string input1, string palin) { if (!Exo4Helpers.CheckIfIsPalin(palin)) { return(false); } return(input1.GroupBy(c => c).Count(c => c.Count() % 2 == 1) <= 1); }
public static bool Checkv2(string input1, string palin) { if (!Exo4Helpers.CheckIfIsPalin(palin)) { return(false); } var frequency = Exo4Helpers.Frequency(input1); int oddFound = 0; foreach (int count in frequency.Values) { if (count % 2 != 0 && ++oddFound == 2) { return(false); } } return(true); }