3 ms·
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 >
by searchableguy 6y ago
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.
- Kaze404 6y agoHow 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.
- searchableguy 6y ago> 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.
- Kaze404 6y agoWell, 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.
- xellisx 6y agoWhat they are looking for is recursion. Of course I believe there are more efficient ways of doing Fibonacci in a normal loop.