Re:What's Wrong with Tech Hiring
by HeyImAlex on Thursday September 16, 2021 @09:01AM
(#28551152)
abcba is a palindrome
[ Parent
| on HN ]
Re:What's Wrong with Tech Hiring
by loup-vaillant on Thursday September 16, 2021 @09:25AM
(#28551457)
Yes it is, and it wouldn't fail my algorithm:
a -> not in set -> add a (a)
b -> not in set -> add b (ab)
c -> not in set -> add c (abc)
b -> in set -> remove b (ac)
a -> in set -> remove a (c)
Set has 1 <= 1 element -> return OK
(Of course, "aabcb" would return yes as well, but that's the whole point: we're not asking whether a string is a palindrome, but whether any one of its permutations is.)