I am getting TLE for my soln can u offer some modification in the code please?
I am getting time limit exceeded in my code
Hi ,
You do not need to do this much .
Process:
1.) Insert All words reversed inside an unordered_map.
2.) Now just iterate over the string array.
3.) For each ith string u just need to search for its reverse inside the map nothing else. ( Now this is for an even palindrome.)
4.) To check if there exists an odd size palindrome. Just do one thing.
For example if your ith string is abcd
Just check for reversed and then reduced string like after reversing . ->> dbca -> cba that’s it so that the new word can be abcd + cba = abcdcba Now u need not check if this is a palindrome.