by Programmatic · 10y ago · 0 comments
https://gist.github.com/anonymous/e8553707cd6162040e7d12b2a1...
stringToTest = stringToTest.toLowerCase().replace(/[^a-z0–9]/ig, '');
But the example solution is so bad anyway.
is_a_palindrome(S) {
assert is_a_string(S)
if reverse(S) == S
return true
return false
}
A string is a palindrome if it's equal to itself reversed. The example "solution" in the article is dreadfully overengineered to death and back. Noone interviewing should be happy to see such a solution and noone being interviewed should expect to be required to give such a solution, to such a trivial problem.Unless of course the recruiter is trying to catch you pants-down, but then the parent article wouldn't post that overengineered "solution" as a gold-standard, like they did.