DEV Community

loading...

Discussion on: Advanced Palindrome Interview Question JavaScript

Collapse
darkwiiplayer profile image
DarkWiiPlayer • Edited

Here's a simple solution in Lua:

local function palindrome(input)
  input = input:lower():gsub("[^a-z0-9]", "")
  return input:find(input:sub(1, math.floor(#input/2)):reverse().."$")
end
Enter fullscreen mode Exit fullscreen mode