Hacker News new | ask | show | jobs
by black3r 2188 days ago
Example of a fibonacci recursion implemented in exponential time just after mentioning big-O notation? Looks just like one of those articles written by a copy-writer who knows nothing about programming and created the article by reading some similar articles thinking he understands it all now

If I were interviewing someone, I would expect the linear solution and from a CS graduate would at least expect mentioning the logarithmic one..

2 comments

Do I get the job?

    defmodule Fibnoc do
      def fib(0), do: []
      def fib(1), do: [0]
      def fib(2), do: [1 | fib(1)]
    
      def fib(n) when n > 2 and is_number(n) do
        [a, b | _] = rest = fib(n - 1)
        IO.puts("a: #{a} b: #{b} rest: #{inspect(rest)}")
        [a + b | rest]
      end
    end
Although I wouldn't call these questions a great way to assess people for the job, they are fine as a way to weed out people who can't program at all. Most high schoolers spend hours leetcoding these days. I do wonder how tough the market would be by the time I can legally work given current trends of everyone jumping into IT jobs.
How does implementing Fibonacci weed out people who can't program at all? Spending hours doing Leetcode is far from a reliable assessment of someone's programming skills.
> Spending hours doing Leetcode is far from a reliable assessment of someone's programming skills.

That's what I mean tho. In high school, they start leetcode practice from day 1 of programming or CS classes. Soon, you will get many leetcoders in the market.

> How does implementing Fibonacci weed out people who can't program at all?

There are many people applying for jobs who can't program a buzz fizz. They exist. A fibonacci is enough to throw them off in an unfamiliar language.

Well, for what it's worth I've been programming professionally for 4 years and never had to write fibonacci even one. I think doing something that's more immediately alike what you'll be doing in the project is more productive for both sides.
What they are looking for is recursion. Of course I believe there are more efficient ways of doing Fibonacci in a normal loop.
Why would you expect grads to come up with the logarithmic solution? That's a piece of trivia that says absolutely nothing about their actual capabilities, just how well they remember their linear algebra.

Also why stop there? An actual smart coder would have looked up the constant time solution instead of bothering with any of that.