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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Check if each letter in the range
, where
is the size of the word, is equal to its corresponding letter (
). If it isn't, then break the loop early and print
NAY
otherwise print YAY
after searching the whole word.
Time Complexity:
, where
is the length of the word.
Comments