Script – 19-47 Feb 2
I am trying to create a palindrome algorithm to make a word a palindrome and return the index I have to remove to make it a palindrome.
I came up with this:
It works fine but after running tests I discovered its not efficient. What other efficient way can be used?
2 Replies
palindromeIndex("eye")
Input is a string
Expected output should be -1 because it's a palindrome already
But if we have "eyes"
, expected output should be 3
which is the index of the letter needed to be removed to make it a palindrome
Definition of palindrome
: a word, verse, or sentence (such as "Able was I ere I saw Elba") or a number (such as 1881) that reads the same backward or forward.This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/938521025778446427