Generation

generate functionMon, 14 Nov 2022

determine if an input is a palindrome

public static bool IsPalindrome(string input) { int min = 0; int max = input.Length - 1; while (true) { if (min > max) { return true; } char a = input[min]; char b = input[max]; if (char.ToLower(a) != char.ToLower(b)) { return false; } min++; max--; } } IsPalindrome("racecar")

Questions about programming?Chat with your personal AI assistant