News for hackers. Stuff that matters.
Re:Things I Learned from a Job Hunt for a Senior Engineering... by CryoLogic on Tuesday April 24, 2018 @01:17PM (#16914552)
I've had this question and replied with:

const isPalindrome(str) { return str === str.split('').reverse().join(''); }

And the post interview notes said bad performance on the isPalindrome() question since I didn't write out my own functions (interviewer did not mention to).

Re:Things I Learned from a Job Hunt for a Senior Engineering... by calcifer on Tuesday April 24, 2018 @01:20PM (#16914568)
Personally, if you gave me this answer I would accept it and then asked you how those functions work and how you would implement them. Still trivial, but it would tell me whether you are familiar with the basics or you just memorized some stdlib functions.
Re:Things I Learned from a Job Hunt for a Senior Engineering... by Bahamut on Tuesday April 24, 2018 @01:37PM (#16914718)
To be fair, if you wanted to do a performant implementation, this is probably a more expensive implementation. The expected response is generally for you to iterate over the string and construct a count map of how many times a character appears in a string, and then iterate over the keys of that object and have at most one odd number in the values of the count map.

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).

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.
Re:Things I Learned from a Job Hunt for a Senior Engineering... by Bahamut on Tuesday April 24, 2018 @02:08PM (#16915042)
Ah sorry, I misunderstood the question - the one I've seen usually is if a string could be rearranged as a palindrome ha.
Re:Things I Learned from a Job Hunt for a Senior Engineering... by dlgeek on Wednesday April 25, 2018 @01:07AM (#16918754)
You're thinking of an anagram, not a palindrome.
Re:Things I Learned from a Job Hunt for a Senior Engineering... by monksy on Tuesday April 24, 2018 @02:19PM (#16915147)
Most of the time when they ask for the palindrome questinon they prevent you from using StringBuilder.reverse.