CST370 Week 1
This week we worked on a palindrome puzzle. I immediately recognized it from when I solved a similar one on LeetCode a few years ago, though back then I used Python. My first instinct was to use a two pointer approach, but I specifically remembered this one because the optimal Python solution was a one liner:
return string.lower() == reversed(string.lower())
I looked up the equivalent syntax in Java and gave that a try. Once I got that working, I added the logic to remove any non alphanumeric characters from the input and then ran the provided test cases to verify the results. Overall it was a really fun assignment.
Comments
Post a Comment