News for hackers. Stuff that matters.
Re:LINQ Ruined My Favorite Interview Question by jkrems on Thursday July 11, 2013 @10:55AM (#6026382)
It looks like collections is part of the standard library: http://docs.python.org/2/library/collections.html. I think this disqualifies your JS solution, as long as doStuff isn't some fancy nodejs core module I missed.
Re:LINQ Ruined My Favorite Interview Question by untog on Thursday July 11, 2013 @11:13AM (#6026511)
I think the point still stands though, when you think of it as an interview question. The point is to get to the bottom of how the candidate would process such a query themselves, not to test their knowledge of the core libraries of their favourite language. I feel like that's what the post author meant when he said that LINQ had "ruined" the question- because it kind of does the same thing.
Re:LINQ Ruined My Favorite Interview Question by rhizome on Thursday July 11, 2013 @02:11PM (#6027897)
Isn't it kind of axiomatic that any question that provides for a concise and measurable solution will eventually be refactored into a library? It seems like kind of a weakness in these kinds of "programmer" questions, that they all regress to trivia. Why not an open-ended business problem and/or deliverables-type question? I'm sure that would speak more to the daily job, where I've never heard of someone being tasked with "OK, find the top 10 words by frequency in a random Wikipedia article."
Re:LINQ Ruined My Favorite Interview Question by untog on Thursday July 11, 2013 @02:56PM (#6028316)
Surely the 'trivia' in this instance is knowing the names of libraries, as opposed to be able to think through programming concepts?

Just like math homework back in the day, the teacher didn't do it to check your answer, they did it to check how you arrived at your answer.

Re:LINQ Ruined My Favorite Interview Question by rhizome on Thursday July 11, 2013 @04:33PM (#6029015)
My memory of the math homework you describe brings up two images: geometry proofs and story problems. Never did I have to explain multiplication when doing my times tables, nor quadratics.
Re:LINQ Ruined My Favorite Interview Question by cben on Thursday July 11, 2013 @01:33PM (#6027578)
collections.Counter.most_common() uses heapq.nlargest() which is slightly more efficient than a full n*log n sort. But implementing a heap correctly from scratch is I guess outside the scope the OP intends for the interview question.

I would expect a good candidate to:

1. know that a heap is optimal here (remembering whether Counter uses it is optional)

2. express reluctance to implement it from scratch because surely the stdlib can do it better.

So IMHO using libraries like this ruins the question only in the sense of showing its not a challenge for the candidate. Something so simple should not take a page of code.

Re:LINQ Ruined My Favorite Interview Question by klipt on Thursday July 11, 2013 @04:39PM (#6029067)
> collections.Counter.most_common() uses heapq.nlargest() which is slightly more efficient than a full n*log n sort.

Creating a heap is O(n) if I remember correctly, so that may well be the most efficient solution.

Re:LINQ Ruined My Favorite Interview Question by CanSpice on Thursday July 11, 2013 @03:29PM (#6028555)
"Sorry, we're stuck with Python 2.3.7 and collections isn't part of the standard library."
Re:LINQ Ruined My Favorite Interview Question by wiredfool on Thursday July 11, 2013 @04:32PM (#6029013)
"""Thank you, I think I've heard enough. I don't think continuing the interview would be a productive use of time."""
Re:LINQ Ruined My Favorite Interview Question by yen223 on Thursday July 11, 2013 @10:25PM (#6030544)
I like the fact that you triple-quoted that statement.
Re:LINQ Ruined My Favorite Interview Question by kenko on Thursday July 11, 2013 @05:12PM (#6029260)
Because of an older version of python?!
Re:LINQ Ruined My Favorite Interview Question by wiredfool on Thursday July 11, 2013 @05:26PM (#6029335)
If they're stuck on a version of software that hasn't been supported in 5 years for bugs or security with a set of features that was originally released nearly 10 years ago, it means that there are some culture issues in the workplace that will most likely drive me insane.

Therefore, I am unlikely to take the job.

Re:LINQ Ruined My Favorite Interview Question by pjmlp on Friday July 12, 2013 @03:40AM (#6031388)
Most companies are not startups, installing software as soon as new releases get available.

Just to give another example, our consulting company still gets requests for projects to be deployed against Java 1.4!