Re:Things I Learned from a Job Hunt for a Senior Engineering...
by wheresvic1 on Tuesday April 24, 2018 @01:56PM
(#16914901)
Err I always thought that the expected performant response is to have two indexes 0 and length-1 and bring them to the middle checking that the values are equal :)
Re:Things I Learned from a Job Hunt for a Senior Engineering...
by glangdale on Tuesday April 24, 2018 @02:02PM
(#16914971)
I'm very confused by this answer. Have I missed a joke? Wouldn't the expected response be to iterate over half the string comparing the characters to the other half (in reverse order)? The criteria you provide seems to suggest aabbc is a palindrome.
The interviewer probably should have probed you about performance though if their intention was to judge you on that (they're both O(n) time complexity, but split, reverse, and join are generally more intensive).