Question
Write a recursive function is_reverse that accepts two strings as a parameter and returns true if the two strings contain the same sequence of characters
Write a recursive function is_reverse that accepts two strings as a parameter and returns true if the two strings contain the same sequence of characters as each other but in the opposite order, and false otherwise. The function is case-insensitive (ignoring capitalization). The string could contain characters other than letters, such as numbers, spaces, or other punctuation; you should treat these like any other character. The table below shows some expected outputs for the different method calls
You are not allowed to construct any structured objects other than strings (no list, dictionary, etc.) and you may not use any loops to solve this problem; you must use recursion.
\begin{tabular}{|l|c|} \hline \multicolumn{1}{|c|}{ Call } & Value Returned \\ \hline is_reverse("CS320", "023sC") & true \\ \hline is_reverse("Madam", "MaDAm") & true \\ \hline is_reverse("Q", "Q") & true \\ \hline is_reverse("", "") & true \\ \hline is_reverse("e via n", "NaIv E") & true \\ \hline is_reverse("Go! Go", "OG !OG") & true \\ \hline is_reverse("Obama", "McCain") & false \\ \hline is_reverse("banana", "nanaba") & false \\ \hline is_reverse("hello!!", "olleh") & false \\ \hline is_reverse("', " x ") & false \\ \hline is_reverse("madam I", "i madam") & false \\ \hline is_reverse("ok", "oko") & false \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started