Fork me on GitHub
#jobs-discuss
<
2016-04-13
>
sveri13:04:37

Hi, anyone ever had to print the fibonacci numbers up to n during an interview or saw people doing it?

jan.zy13:04:18

and I couldn’t use Binet’s formula for that!

sveri13:04:12

Some questions, if you dont mind: 1. Do you have a diploma in cs? 2. How long did you take? 3. Did you solve it recursive or implerative? 4. Would you hire somone that did not solve it (for whatever reasons, stress, knowledge...)?

jan.zy13:04:28

no, a few minutes, both, it doesn’t matter

dottedmag13:04:44

1. yes; 2. a few minutes; 3. both; 4. probably not

jan.zy13:04:01

why do you ask?

sveri13:04:23

I had one applicant today who failed doing it. I just wonder what the reasons might be. He has a proven record of implementing things with spring, JBoss, developing interfaces, transforming data, using JAXB and some more stuff. I wonder why he failed that test.

dottedmag13:04:30

@jan.zy: Is there an easy way to use Binet's formula on a computer and not lose precision?

dottedmag13:04:25

@jan.zy: E.g. a Python expression gives me 190392490709135.44 for 70th Fibonacci number.

jan.zy13:04:36

honestly, I didn’t implement it, but I wouldn’t expect any problems with that

dottedmag13:04:03

And sqrt(5) is irrational, no easy way out.

sveri13:04:05

it was a whiteboard test by the way, no one looked for syntax

fxposter13:04:20

have you seen him failing the test or just know the result?

dottedmag13:04:39

@jan.zy: Trivial implementation on double precision IEEE754 starts to lose precision at fib(69).

jan.zy13:04:01

ahh, you got me!

sveri13:04:04

@fxposter: I have seen him failing it.

chris13:04:18

We did not hire the last person to fail the fibonacci test, but that was for lots of other reasons

chris13:04:28

was he nervous?

sveri13:04:05

Not obviously. We solved it together at the end, and he was very open about it. I just cannot get a hand on it.

chris13:04:06

A proven record of “developing interfaces, transforming data” seems way more important than a silly test to me

sveri14:04:49

@chris I agree, I just wanted to get a feeling for it simple_smile

jan.zy14:04:11

btw, why do you ask people to implement fibonacci? for me it’s a minus for a company for not being creative enough: - we can safely assume that you’ll never need to know fibonacci series in day-to-day work. - it’s asked so often that many candidates just write the code straight out of their memory

jan.zy14:04:55

same goes for implementing hashmaps, quick sort, merge sort and reversing a string

sveri14:04:33

@jan.zy: what would you suggest for a 5 - 10 minute test?

dottedmag14:04:43

@jan.zy: It's a good way to filter out 95% of candidates (this is the average amount of clueless ones).

dottedmag14:04:41

But it has to be done by HR at prefiltering stage, probably.

jan.zy14:04:57

@sveri, do you need only 5 - 10 minutes to check programming skills of a candidate? @dottedmag: true, they should be filtered out by hr

dottedmag14:04:36

@jan.zy: 5-10 minutes test is enough to get rid of obviously unfit ones.

sveri14:04:53

@jan.zy: Well, thats all we have here. It is not even that common to have tests, depending on the business.

jan.zy14:04:42

o dear, that’s one more reason to not to ask about fibonacci if you have so little time. I would at least use a different series!

pyb14:04:56

Maybe he was stressed, even if he didn't look it.

cky14:04:49

#ObFizzBuzz

cky14:04:55

@sveri: I’d be happy to PM you some 5-to-10-minute questions I’ve seen.

sveri14:04:36

@cky that would be nice simple_smile

thomas15:04:00

fibonacci is a very contrived that IMHO….

thomas15:04:09

the only real trick to it is recursion….

thomas15:04:45

and I don’t think I have ever used recursion outside of clojure.

thomas15:04:07

s/that/test/

thomas15:04:05

@sveri: and some people are against whiteboard coding exercises… they don’t like it at all. I think Bodil mentioned that she didn’t like them.

sveri15:04:03

@thomas: Yea, actually that was the one think he figured out fast, that he had to use recursion. At least it's easier, afterwards my boss showed an iterative version. Also we had a short discussion about stack usage afterwards. It is not a showstopper for us, of course.

cky15:04:53

You can write a memoised recursive version that didn’t cause exponential runtime.

tjg15:04:39

Maybe the applicant switches into a different (worse) mode of thinking with math-y things, but not with other domains?

tjg16:04:07

BTW, I was recently reading "Playing with Math: Stories from Math Circles, Homeschoolers, and Passionate Teachers." http://naturalmath.com/playingwithmath/

tjg16:04:08

Due to internalized math hate/fear, I'd personally avoid giving math questions.

sveri16:04:12

I get that, also I am absolutely ok with that. I got my own fears too, of course simple_smile

jrotenberg17:04:56

good old fizzbuzz has been great for us for that initial “do you actually write code?” screening

cky18:04:37

(doseq [i (range 1 101)]
  (println (case (mod i 15)
             0 “FizzBuzz”
             (3 6 9 12) “Fizz”
             (5 10) “Buzz”
             i)))

cky18:04:32

(I actually would appreciate feedback on how to make the above more idiomatic.)

sveri19:04:26

@cky I find it hard to read, cause in my head I have to map more calculations to the result. I like the (cond (= 0 (mod i 15)) ... (= 0 (mod i 3))... more, cause it is obv. what it does. But maybe that is just personal taste.

cky19:04:20

@sveri: You would use (= 0 x) over (zero? x)? 😛

cky19:04:31

But otherwise, fair enough.

sveri19:04:40

True, I often forget about the nice little helper functions

sveri19:04:45

Ohterwise I like the idea of wrapping println around the cond / case

thomas19:04:50

there is also a version which uses cycle somewhere.

cky19:04:28

@thomas: Thanks! I must try to write a cycle-based version. 😉

alandipert19:04:01

@cky: i like yours, had no idea case could take a list on the left like that

cky19:04:33

@alandipert: Thanks! And your match one is very nice too.

slipset19:04:41

I had @hypirion for a interview once, and asked him to implement fizzbuzz.

sveri19:04:58

I have no idea how it works, but it almost looks like art