Longest palindrome in a given string using LINQ
Well, I think your algorithm is correct, but the code is quite bloat. Your code suggest that the longest palindrome size can be calculated by sum of n / 2 * 2 where n is the count of distinct alphabet that exists more than once in the string, and plus 1 if there are any "oddCounts". So you can reduce the code to

    private static int GetLongestPalindrome(string value) {
        var map = value.GroupBy(c =&gt; c);
        int result = map.Sum(r =&gt; r.Count() / 2 * 2);
        if (map.Any(r =&gt; r.Count() % 2 != 0))
        {
            result++;
        }
        return result;
    }


n / 2 * 2 is the way to calculate for the nearest even number toward zero, and it equals to n - 1 where n is positive odd number.