4 ms·
Did you require a certain time complexity? I came across this on Leetcode. I found it really trivial to implement the “test all substrings” algorithm, but fiend
by alexthehurst 8y ago
Did you require a certain time complexity? I came across this on Leetcode. I found it really trivial to implement the “test all substrings” algorithm, but fiendishly difficult to implement the “expand around centers” algorithm.
- fjsolwmv 8y agoThat's why trick puzzle questions are bad interview questions. Some people have read the centers algorithm
- User23 8y agoIt’s not a trick question. It’s just writing a loop any CS graduate or equivalent autodidact should have absolutely no problem with. We didn’t require any specific time or space complexity. If the candidate whipped out a suboptimal solution quickly and correctly and time permitted we might ask them about that though and how it might be improved. The purpose of the question is not to see if the candidate has memorized the answer or sees a trick, it’s so they can demonstrate basic proficiency and systematic reasoning.