Comment by timmg
4 hours ago
My first ever programming interview was like a group interview. There were three or four programmers asking me questions, one at a time.
The only one I remember was to check if two strings were equal (in C). I wrote (maybe buggy) code to iterate both pointers, comparing while looking for the null terminator.
The interviewer stopped me and said, “You should compare their lengths first. If they are different, you can exit early.”
I was pretty young and didn’t know much, but I explained, “But you have to look for the terminator to find length so it’ll take twice as long.”
He snapped, “There are optimized functions for that!”
I assumed he was right. Needless to say, I didn’t get the job.
Maaaany years later, I realized the std library was probably open source. So I checked (one). It was nice to be vindicated :D
On the upside, think how annoying it would have been to be part of that team and have a boss that doesn't have any ability to admit he is wrong.
Yep, sounds like a bullet dodged there.
Funny how often "there are optimized functions for that" really means "I haven't thought through what the optimized function actually has to do"