During my first-ever technical interview, the interviewer asked me "Do you know the FizzBuzz problem?"
"Uhh, not really." (I was just thinking ok this problem has a name, must be some algorithm problem)
"So the problem is basically to give you the numbers 1 to 100, if the number is divisible by 3, print 'Fizz', if divisible by 5, print 'Buzz', if divisible by 3 and 5, print 'FizzBuzz'. For other numbers just print out the number itself."

After hearing the problem, I felt so many ideas popping out of my stressed brain.

I thought for a bit and said "ok, so if the digit sum of a number is a multiple of 3, then the number is divisible by 3, and if the last digit is either 0 or 5, it's divisible by 5."
Then I started to code out my solution until the interviewer said "there's an easier solution. Can you think of it?"

This stressed me out even more.

I thought for a bit and said "well, starting from 3, keep a counter that records how many iterations are done after 3. When the counter hits 3, that number would be divisible by 3 for sure. Should I try this solution?"
The interviewer said "Sure." So I started again.

However, I struggled for about another 3min until I realized this solution is a lot harder to implement. The interviewer probably saw my struggle too.

This was the point where he stepped in and asked me "Ummmm there's an easy way of solving this. Have you heard of the MODULO OPERATOR?"

In sheer embarrassment, I finished the code in 30s.

Of course, there was no further question after this, and I felt the need to seriously reevaluate my intelligence afterwards.

  • 3
    This is probably the only problem that you will ever face using the modulo operator.. which is why I don't like it very much to prove skill
  • 8
    @Crost dood dafuq? The modulo operator is literally used everywhere: hashing, queues, load balancing, unit and currency conversion, to name a few. U high? Lol
  • 2
    @rantydev last time you implemented your own hashing algorithm? Or the others
  • 4
    I dislike these coding thingies.

    Said it many times, saying it again: Coding certain problems doesn't mean shit.

    All the leet code / algo sites etc prove my point imho - people just learn to solve these problems by heart without having a clue regarding actual problem solving.

    It's better to talk about why and how they code, what their methods are regarding problem solving etc.

    You don't want someone as a dev who can only reproduce what they've seen or learned from others....
  • 1
    @Crost I'm into competitive programming so it happens on the regular.
  • 1
    @IntrusionCM that's the learner's problem imho. You may argue like that for anything: that's the problem with driving school, people just learn the motions and the traffing signs, it doesn't prepare you for the complexity of driving over to your grandma's.

    For any thing, you can learn to DO IT, or you can learn IT. What you do is your responsibility.
  • 0

    Driving lessons have a practical part - usually you're required to take a practical test, too.

    But driving and programming is a vast difference.

    Even better - instead of programming, let's say IT in general.

    Someone who excels at a specific field, e.g. a language, but can not be integrated in a team, not make any compromise and who identifies with their code?

    Pretty much not the guy you want to hire.

    Every critic will end up in mayhem.

    There's a lot in IT that cannot be learned - be it the psychological aspects or soft skills like decision making, problem solving, etc.

    These are things you will not learn as an interviewer by giving someone a multiple choice test and let him cross the answers, nor by letting them write leet code.

    You have to talk and listen - which is important. After all - you want the person to stay in the company if recruited - if you only focus on the company's interest, you'll most likely end up in high turnover rate.
  • 0
    @IntrusionCM I agree with you on all points.

    But I'd add that ours is a technical field. You should know the technology (which in this case is algorithms and data structures); especially in how they reflect on whatever problem you're trying to solve. You can be th best "team player", but if your technical knowledge amounts to copying from stack overflow I won't hire you.
  • 2
    Here my branchless (except the loop) version from last time:
  • 0
    @Crost any counter that rolls over uses modulo.

    not sure if it's because i'm a game dev, but i use it regularly.
  • 0
    @Midnight-shcode Or, if it's a power of 2, you can use binary 'and'. Like:


    mod_32_cnt &= 0x1F;

    But the compiler may also optimise that automatically if you use modulo by a power of 2.
Add Comment