4 ms·
How many zero-modulus solutions (and still using a loop, not just a long precomputed string) have you seen? In my experience, this is the rarest type. Of those
by userbinator 12y ago
How many zero-modulus solutions (and still using a loop, not just a long precomputed string) have you seen? In my experience, this is the rarest type. Of those who can write a correct FizzBuzz (which is already a pretty small fraction of the total candidates), I like to ask "how would you do this without any modulus" and very few of them can easily see the pattern that makes this possible.
Aside: it astounds me how many people, when asked to write a short snippet of code during an interview, have basic formatting problems and inconsistent code style.
If this is being done on paper or an absolutely "non-IDE" text editor then it's probably someone dependent on an IDE to do the right formatting for them. If they still do this in an auto-formatting IDE, it's probably a sign that they have no good idea of the structure/flow of the code.
- detaro 12y agoWhat is the "optimal" answer you are looking for if you ask to solve it without modulus? Build modulus by hand, or using additional resetting counter variables?
- userbinator 12y agoTwo counters, one that counts by 3 and one that counts by 5.