Codes
Answers
-- lua recursive palindrome, by bryankrn https://github.com/llucere/lua-bahamut-challenges/blob/main/src/recursive_palindrome.lua
local function isPalindrome(str)
if (#str <= 1) then return true end
local firstChar, lastChar = string.sub(str, 1, 1), string.sub(str, -1, -1)
if (firstChar == lastChar) then
return isPalindrome(string.sub(str, 2, -2))
end
end
print(isPalindrome("tattarrattat"))
Questions
Answers
Answer accepted
Users
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us