Question: The following function is supposed to check whether or not the substring of an input string str beginning from an input index start and ending
The following function is supposed to check whether or not the substring of an input string str beginning from an input index start and ending at an input index end is a palindrome. For example, if the parameters are (INANC, 0, 4), the function returns false because INANC!=CNANI; but if the parameters are (INANC, 1, 3), the function returns true because the substring between index 1 and index 3 of INANC is NAN and it is a palindrome (it reads the same from left to right and from right to left.). b
boolean IsPalindrom(string str, int start, int end) { if (str[start]==str[end]) return IsPalindrom(str, start+1, end-1); else return false; }
This function is missing an important part. How should we complete it?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
