Hacker News new | ask | show | jobs
by cantastoria 5386 days ago
I'm curious what candidates are getting stuck on. Is it the testing for divisibility that's tripping them up?
4 comments

Mostly they just don't know how to start. They can't break down the problem into subproblems. Once a candidate managed to break down the problem to subproblems, they can always do the rest easily (solving the subproblems, composing the solutions to solve the main problem).
Ok in that case then they're a no hire as that's just a fundamental part of developing software. Although I must admit that this problem surprises me more than people's inability to code. I mean if you can't break down problems you're just ill suited to the field.
For me the hardest part would be remembering a print function that does not automatically insert a newline. Although I suppose as a workaround assembling the string before printing would work, just less elegant.
If you cannot programme, you would not be able to do this problem. There are people who cannot programme applying for programming jobs. Shocking, but true.
OP may not be actually using "FizzBuzz" as he said a FizzBuzz-type problem :)
Ok fair enough, but I'm still curious where the sticking point is. Can they at least code the loop? I'm wondering if it's just that peoples' math skills are typical pretty rusty and if using another set of conditions would give you better results.

Edit: For example, iterate through this string every time you hit an 's' print fizz etc...

For some reason this is the most common mistake I see from students:

    for i in range(0,n):
      if i % 3 == 0:
        print 'fizz'
      elif i % 5 == 0:
        print 'buzz'
      elif (i % 3 == 0) and (i % 5 == 0):
        print 'fizzbuzz'
      else
        print i
It's not so much arithmetic that's the problem but reasoning about overlapping boolean conditions.
Hmmm.. I see. Is this done on a whiteboard? If you let them use an editor and run it and they fixed it right away would that be acceptable?

I wonder if people are getting such bad results on this because it's always the first question they ask and the candidate isn't comfortable yet.

Agreed. When we see people trip up it's often becaues of this.

I think the problem is the old adage about not being able to to see the forest for the trees.

They break it down to the simple components and write those fairly easily but the forget about big picture of all 3 conditions working together.