My program for Q4. // recursively find if a given string is palindrome bool IsPalindrome(string s, int start, int start2, bool flag) { bool flag1 = flag; if (start >= 0 && start2 < (s.Length)) { char c1 = s[start]; char c2 = s[start2]; if (c1.Equals(c2)) { if (start == 0 && start2 == s.Length - 1) { flag = true; } if (IsPalindrome(s, start - 1, start2 + 1, flag)) { flag1 = true; } } } return flag1; }
while calling if (s.Length % 2 != 0) { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2 + 1, false); } else { p.IsPalindrome(s, s.Length / 2 - 1, s.Length / 2, false); } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/I6SVTB0o-uUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.