Hacker News new | ask | show | jobs
Is String a Palindrome (harrisonbrock.blog)
1 points by harrisonbrock 2282 days ago
1 comments

It's more efficient to compare r[beg] and r[end] directly than to construct a temporary string.

The tests should include failing test cases too, that is, strings which aren't palindromes.

The test cases are all of odd-lengths. An even-length palindrome should be included because palindrome implementations sometimes fail with even lengths but not odd, or vice versa.

The empty string should also be a test case, for the same reason.