Editorial for JDCC '15 Contest 4 P1 - Palindromes


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: aurpine

Check if each letter i in the range 0, S/2, where S is the size of the word, is equal to its corresponding letter (S-i-1). If it isn't, then break the loop early and print NAY otherwise print YAY after searching the whole word.

Time Complexity: \mathcal{O}(S), where S is the length of the word.


Comments

There are no comments at the moment.