Simple, might be wired solution, lol C#


  • 1
        public int LongestPalindrome(string s) {
            int rs=0;
            int[] std=new int[58];
            for(int i=0;i<s.Length;i++)
            {
                std[32+s[i]-'a']++;
                if(std[32+s[i]-'a']%2==0)rs+=2;
            }
            return rs<s.Length?rs+1:rs;
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.