Hacker News new | ask | show | jobs
by WrtCdEvrydy 2313 days ago
To be honest, I didn't know that one... I just did basic double division the first time I saw it (into a float and compared it against an int casted back to a float). Someone in the interview room asked my if I remembered modulo and I was like 'oh yea, it gives you the remainder'
2 comments

That's honestly more impressive for creativity sake!

FizzBuzz is just an example of the general problem of "given a set of things, do something to a subset of those things" which comes up often in real world settings. If you knew enough to set up a loop and apply some conditional inside of it, then you passed better than some of the programmers I've worked with.

That operator's one I've used more on puzzles than in real life, where I've used it few enough times in 15ish years that I could count them on one hand. I think it only sticks in my mind because, for whatever reason, it was taught early and with some emphasis in a Perl book I read when I was starting out. If not for that I could well fail to come up with a reasonably "correct" solution to FizzBuzz.