Editorial for Murder for a jar of red rum

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: Tommoa

Editorialist: Tommoa

Ah, palindromes! This question required that you take in a string and denote whether it is palindrome, ignoring case, punctuation and whitespace.

This problem can be solved in \(O(n)\) by reading in the string, transforming it character by character to lower-case (e.g. using C++ transform(str.begin(), str.end(), str.begin(), ::tolower)) and then simply checking the front and the back of the string to see if the two results are the same while skipping anything that isn't an alphabetical character. If you make it through the whole string, then its a palindrome and you can print True otherwise, print False.

Most teams took a few attempts at this, mostly because almost everyone missed that punctuation doesn't matter for the purposes of this question.


There are no comments at the moment.