Live data from Hacker News

A way to torture an interviewer (C++, FizzBuzz)

news.ycombinator.com

31–40 of 84 posts

Re: A way to torture an interviewer (C++, FizzBuzz)

#32
post #3

Yay, let's talk about FizzBuzz! This is the fastest PHP version I could come up with so far: I'm sure there still are ways to make it faster. But I fail to think of them. Except for unrolling multiple loops into one. But that is so ugly. Any ideas of elegant ways to make it faster? Testing the performance like this: php fizzbuzz.php | pv > /dev/null 215MiB/s on my slowish laptop. The "yes" command gives me about 10x…

Probably your implementation is limited by the speed PHP/echo can output things to stdout, rather than your implementation per-se. Better, use a benchmarking framework/library to see how many OP/sec you can do, within the PHP runtime, so you remove stdout from the benchmark.

Well, that's part of the challenge. To write to stdout as fast as possible.

There is a large FizzBuzz shootout here that I like:

https://codegolf.stackexchange.com/questions/215216

I think it's a nice "standard" for FizzBuzz comparison.

Re: A way to torture an interviewer (C++, FizzBuzz)

#33
post #2

If a candidate were suggesting this as their serious FizzBuzz implementation fit for production, I'd have a hard talk with them about readability.

What implementation of FizzBuzz do you use in your production environment?

Obviously outsourced to a 'competent' FBaaS provider!

https://fizzbuzz.ketzu.net/to/100

(Also fun when you just outsource task in a language introduction task in a leetcode-like setting and get surprised it actually allowes you to make http requests...)

Re: A way to torture an interviewer (C++, FizzBuzz)

#35

You wouldn't torture him. You would just zero the probability of getting an offer. There's no SW house or colleague in his right mind that would want a developer that writes obfuscated and needlessly complex to understand code.

I would not want developer to write this kind of code in production applications but I would very much hire a person who is capable of coming up with the code like this.

Re: A way to torture an interviewer (C++, FizzBuzz)

#36
post #32

Earlier quoted context omitted.

Probably your implementation is limited by the speed PHP/echo can output things to stdout, rather than your implementation per-se. Better, use a benchmarking framework/library to see how many OP/sec you can do, within the PHP runtime, so you remove stdout from the benchmark.

Well, that's part of the challenge. To write to stdout as fast as possible. There is a large FizzBuzz shootout here that I like: https://codegolf.stackexchange.com/questions/215216 I think it's a nice "standard" for FizzBuzz comparison.

Well, then remove the whole "fizzbuzz" part of the equation and just try to output as much data to stdout as possible.

Conflating the two seems to confuse more than measure anything useful.

Re: A way to torture an interviewer (C++, FizzBuzz)

#39

You wouldn't torture him. You would just zero the probability of getting an offer. There's no SW house or colleague in his right mind that would want a developer that writes obfuscated and needlessly complex to understand code.

QA engineer for a C++ compiler?

This program is undefined, so no, except maybe if you can make the compiler itself to crash.
Post reply on HN