Find the max ;length palindrome in an input string.
Anonymous
A stupid and slow solution (O(n^3)): public static string MaxPalindrom(string str) { string maxP = String.Empty; for (int i = 0; i maxP.Length) { maxP = str.Substring(i, j - i); } } } return maxP; } private static bool isP(string str) { for (int i = 0, j = str.Length - 1; i < j; i++, j--) { if (str[i] != str[j]) { return false; } } return true; }
Check out your Company Bowl for anonymous work chats.