On Tue, Sep 04, 2012 at 12:25:57PM -0400, Uri Guttman wrote: > On 09/04/2012 08:03 AM, Mr I wrote: > >>> >>> I've literally had people who were "Senior" programmers (whatever that >>> means) who, when given the instructions "Given that fib(n) is equal to >>> fib(n-1) + fib(n-2) write a fib function in any language" didn't even >>> get to the >>> >>> sub fib { >>> my $n = shift; >>> return fib($n-1)+fib($n-2); >>> } >>> > >>> >> IMHO this is a typical example of an awful question! >> >> It requires additional knowledge of the problem domain NOT asked by the >> interviewer.Your assumption is that the candidiate knows: >> >> a) the fibonacci sequence >> b) mathematically how to calculate (included recurrence) >> > > why do they need to know it? they are given the formula!! > > and they can do a linear version if they don't know recursion. > > and knowing recursion is a good coding test to filter out the wannabes > from the serious coders.
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. Your first instinct should be "Is there a generating function I can use?". Abigail