Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
zhala
· 3y ago · 0 comments
We've found that asking them to write a function to average a list of integers. That's filtered out a surprising number of "senior level" applicants.
Comments
[–]
6510
3y ago
with(arr)eval(`averaaaaaage=(${join`+`})/length`);
[–]
pklausler
3y ago
mean = liftA2 (/) sum length
[–]
Kranar
3y ago
I mean that could satisfy the interviewer, but for me if I asked that question, I'd want an answer that protected against overflow and unfortunately the naive solution is prone to overflow.
[–]
whatshisface
3y ago
That could turn in to a very complex question in that case because dividing too many separate sums before adding would introduce rounding error.
[–]
anyfoo
3y ago
Does that not have to be
mean = liftA2 (/) sum (fromIntegral . length) ?