UPDATE: You can follow the discussion on Hacker News.
Figuratively of course but still, array search, sorting and related interview questions are very boring, unreasonable and borderline irritating. Last month I was looking what is out there on the job market. All this hype about shortage of developers got me interesting in exploring new opportunities. I enjoyed meeting new people and learning about technological stack and problems companies try to solve. There were about a dozen phone interviews and a half-dozen face-to-face meetings. Most of the companies are regularly featured on TechCrunch. They are your typical VC-backed, 100–300 people startups. They have tons of perks as bicycle storage, tennis tables, free drinks and lunches, nerf guns, casual approach, lots of beer — all these tricks to lure employees. :)
Now here is the bad part. It didn’t matter much what technology startups use or what level of seniority was required for the position I was interviewed for. No. 95% of the time there were variations of array search and sorting, finding min / max value in array combined with providing big O notation, complexity and efficiency of such algorithms and functions type of questions. Two times I was asked exactly the same question:
Write function find_matches(haystack, needle) which returns array of all the matched elements needle array in haystack array with duplicates considerations.
The best answer to this question involves the use of a hash in which keys are values of needle array elements. And values are counts of repetitions of needle array elements in haystack array. Second time I’ve heard it I was bored even more than my interviewer, the VP of that startup. :)
I understand that there is never enough time in a startup. I’ve been on the other side of an interview process a few months ago. But I never took a shortcut. Maybe arrays are the only thing those “brain-dead” people remember from C++ class they took 10 years ago to fulfill their Computer Science degree requirement. Yes, 10 years ago it did matter which function to use, because memory and CPU were expensive. Not anymore! When is the last time you had to write your own array sorting function or function that performs search in an array? There is always a function for that in a high-level languages like Ruby (index), JavaScript (indexOf) or Python (index). And if you did write your own that is probably because you couldn’t find it (learn how to Google) or you didn’t bother to find it. In both cases it’s usually a bad idea because build-in functions are very efficient and your / our code is usually not efficient. Why test and ask for something which you are not using in real development? Why not look at candidate’s GitHub repositories, live websites and apps? Why not solve real problems your startup has at the moment?
Another sad thing, which I gladly didn’t see that much (but there still were a few interviewers) in the Bay Area compared to the East Coast, is asking terms, function names, definitions, slang, etc. Expecting people to remember functions’ syntax is a sin in itself! All this leads to hiring people with good memory vs smart people. That’s especially wrong when all these information is only a Google search away. And being smart can’t be acquired or substituted with search engine results.
Dear interviewers, please be creative if your goal is to find creative, smart people! Also remember that code is not an asset. It’s a liability. The more you code the more you’ll have to maintain. :)
You are absolutely right, I had one today morning and was asked a question which I was asked to solve a problem wihout using a hastable that they themself have created in one of their owned languages. So I wrote the trivial code they expected and wanted to optimize it. I was like, what the heck, I spend my 13 years working in your technology that tries to minimize developers burden of coding and now you want to show how I would write basic code in c that too when the team does not need that. The only thing I thought was either they need robots that code, not smart people who think and work their way up. OR their daily day to day work is finding max of arrays like trivial work. I would not work for such team though.
I just feel that interview questions should be targeted to discover software engineer who can design instead of just construct. Design as in strategies, i.e. what to build. Construct as in writing a function, how to write the code. Frankly speaking, most function codes are early available by google. You need designer to put them into good use.
I’ve been going through the same thing recently. To my surprise, not once have I been asked a question related to OO principles or the design of simple, maintainable code. What costs a company more, an inefficient algorithm or spaghetti code?
Also, why ask for my Github account and an implementation for a given idea when the first thing you do after reading my resume is send me a fucking array search problem?
I totally agree with the above commenter.
The problems you solve on a day-to-day basis at a real job are so trivial that if you asked only those things, you wouldn’t really be testing much.
I think that if you test for basic computer science fundamentals, then you have a fair idea that a person isn’t a previous life basket weaver who’s trying to capitalize on this new computer-programming-job fad.
Also they’ve always had extremely good implementations of binary search, quick/merge sort and other basic algorithms in libraries of languages like C,C++, etc., ever since I can remember, the point isn’t to test if you could sort or search or something on google fast.
There’s something else questions like these reveal – how you react to inquiries you consider “beneath you”. Do you get annoyed? Do you preach? Do you adopt a condescending attitude? You might be able to do the tech work, but part of the job might be having to interact with various departments who just aren’t as gosh-darned smart as you. How do you react when questioned about such ‘trivial’ matters? Do you lose your cool? You might not be a great fit for the culture of the org then.
What Cam said. These questions of “weed out” questions. It’s mind-boggling how many people graduate college with a BS and even MS in Computer Science that completely fail the Fizz Buzz question.
Put yourself in the interviewers shoes – they have to ask the same ridiculous questions day in and day out.
I think you’re missing the whole point of the array search question. Yes, it’s boring and easy. Yes, in the real world you don’t really ever have to do this. But it is really easy, the point of this question is to filter out crappy programmers (just like the popular Fizz Buzz question). I’ve asked similar questions to this, and many of the candidates fail it.
Interview questions aren’t designed to entertain interviewees, they’re filter mechanisms.
You’re point about syntax memorization is fair.