Question PSC-FUNC-0079
HardWhat will be printed by the following pseudocode?
Function pal(String s)
if (length(s) <= 1) return true end if
if (s[0] != s[length(s) - 1]) return false end if
return pal(substring(s, 1, length(s) - 1))
End Function
Print pal("racecar"), pal("abca"), pal("")
- A.
true true true
- B.
true false false
- C.
Sign up free to see the answer and a step-by-step explanation.