DEV Community

Cover image for Advanced Palindrome Interview Question JavaScript

Advanced Palindrome Interview Question JavaScript

Hello Dev World Blog on January 01, 2021

Link to the video 365 days of coding day 1! If you don’t know what 365 days of coding is check this out! Today we are going to tackle a ...
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • 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