Palindromic Subststrings
public static List<string> SubString(String str)
{
var list = new List<string>();
for (int i = 0; i < str.Length; i++)
{
for (int j = 1; j <= str.Length - i; j++)
{
var temp = str.Substring(i, j);
if(temp==ReverseString(temp))
{
list.Add(temp);
}
}
}
return list;
}
public static string ReverseString(string s)
{
char[] arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
PrashantUnity