Skip to content

Comment on FizzBuzz: the test helps filter out the 99.5% of programming job candidatesparent

Comments

prime numbers

Isn't that harder than the actual question?

Is it? Seems to require about the same knowledge as the original FizzBuzz. Even if it didn't, if a candidate couldn't write the logic to determine if a number is prime or not... that's another red flag.

  def is_prime(x):
    if x%3 and x%2:
      return True
    else:
      return False

  print is_prime(4)
  print is_prime(7)
EDIT: Oops, nevermind... you're all right and I'm wrong. I'm not fixing this code so everyone can see exactly how I screwed up.

I can't even tell if you are being sarcastic or not. Either way I certainly wouldn't hire you.

Edit: Perhaps you should keep this in mind next time you declare 99% of programmers incompetent because they made a typo when you asked them to write code down with pencil and paper in a high pressure interview situation.

It's amazing how much doing a few interviews inflates people egos.

Thats unfortunate, you just red flagged yourself! I think its time to never ask your interview candidates that question again.

Rosetta Code has some examples of different methods and different languages. The most naïve way is trial division: http://rosettacode.org/wiki/Primality_by_trial_division

Maybe with respect to debugging someone else's code... The related interview question:

"What's the first (positive) number my function will have wrong?"

I was just reading it again and again to see the thing I was missing :)

0.o

25 ?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.