3 ms·
Isn't brute force just O(n^3)? Loop over each character to start potential palindrome, loop from start character to end, reverse substring and compare. But yeah
by orangecat 16y ago
Isn't brute force just O(n^3)? Loop over each character to start potential palindrome, loop from start character to end, reverse substring and compare. But yeah, the test input should be longer and/or smarter. Ditto on the third problem.
- brown9-2 16y agoreverse substring and compare D'oh! My is_palindrome(word) just got a lot shorter, thanks :)