Brainbench perl test?
Peter Corlett
abuse at cabal.org.uk
Thu Sep 6 15:55:36 BST 2012
On 5 Sep 2012, at 17:35, Abigail wrote:
[...]
> No. Well, it filters out the wannabees. It doesn't recognize the serious
> coder. If, given the Fibonacci sequence, or a similar recursive formula,
> and your first instinct is to solve it with recursion or iteration, you
> aren't serious.
Isn't the *point* of this to be a simple test to quickly filter out the no-hopers? I'd hope it wasn't the *only* test.
Were I to be given this particular chancer-filtering shibboleth at an interview, I'd smile and comment that it's a classic interview question, and then explain that I don't have a mathematical background and thus don't know if there's a clever algorithm to find the Nth element in the sequence in less than linear time[2], but I'd research it if this was a problem that came up in real life as opposed to an interview. I am, after all, a programmer who usually hacks on server backends, not a mathematician or computer scientist. I'd then note that there are two recursive solutions, one atrocious but which most-closely models the mathematical description, and one merely rubbish that has an optimisation hack, and also a more sensible iterative solution (unless there's the aforementioned mathematical trick) and ask the interviewer which they'd prefer before making a stab at it in my doctor's handwriting on the whiteboard.
The interviewer now knows several useful things me: I've been around the block enough to recognise famous problems[0], there are holes in my knowledge but I know they exist and I'm prepared to find and learn new stuff where necessary, understand recursion and algorithmic complexity and trade-offs between time, space, and code legibility[1], and will ask questions to clarify requirements rather than go off and possibly implement the wrong thing.
Of course, booking.com is famously odd, so your interviews may well optimise for different abilities in their staff, and so this may not be not a good question for you. TIMTOWTDI applies to interviews too.
[0] Although if they asked me to prove Fermat's Last Theorem, I would suggest they might want to interview Andrew Wiles instead. I have no idea if he's any good at Perl, but given academics tend to be lousy programmers, the odds aren't good.
[1] The only reason you'd ever use the expensive recursive solution!
[2] Or at least, the solution needs more mathematics than would be required for something like "write a function to return the sum of integers from 1 to N", which has a reasonably obvious constant-time solution and is the kind of problem that does appear in real code.
More information about the london.pm
mailing list