I suspect quite a lot of people who are labelled as "can't code" are freezing like I did.
- give them ~30 minutes on their own machine
- they get to pick the language they code in
- I leave the room for large parts of it
- I bring them a drink
- I tell them I want to see what they can do and that I don't care if they complete it
- permit them to search on the internet (as long as they don't copy/paste a solution)
I see this usually: - they finish in a few minutes
- they just can't do it, even with hintsDo you ever have a conversation with these people as to why they think they couldn't do it?
really? they get 30 minutes + internet and they couldn't google "javascript how to get divisible by 3"? That's just bad research at that point.
However, counter point, I've had people forced on me through much of my career who just can't code for the most part, and despite being pretty reasonable about it ( it's part of the nature of the work I do ), I'm very rarely surprised by competency.
The failure rate of FizzBuzz has always struck me as depending on the idea that you can do a lot of programming and just never need that operator.
I only know it well because it was covered near the beginning of one of the first programming books I picked up (on Perl 5) and it stuck with me because it seemed wild to me that they had an operator for that.
for (…) {
heavy_op();
if (i % 100 == 0) {
printf("not dead");
}
ClassicSo even in a language w/o a mod operator, it's not a hard problem if you understand how to solve problems with code.
But without any "real" math at all you can do it with, eg, two counters and some if statements. Or if you recognise that there's a repeating pattern you can work out that pattern manually and just write code to emit it over and over.
At least for me it would be sufficient if the person used a function like IsMultipleOf(x, m), or Remainder(x, n). This would at least make it clear what the function did even if they didn't get the exact operator.
The other thing to note is that the mod operator works differently on different languages and platforms.
Not with positive inputs, which is the domain of FizzBuzz.
Even if you don't know what "mod" means, if you have no idea know what a remainder is, and that the problem calls for it, and you can't derive the mod operator using integer addition, subtraction, multiplication, and division, then your math and problem solving skills are pretty weak, which FizzBuzz tests.
The specific failure was that I first attempted to solve by using repeated subtraction. The guy kept asking me to "solve it a different way", or saying "there is a better way to solve this". I tried using arithmetic tables, I tried using results about base10 remainders and I even tried using one of the corollaries to Fermat's little theorem to speed it up for larger inputs... every time I was told I was getting it wrong because "there was a better solution". In the end he pointed out that the only solution he would accept was use of the mod operator.
Since then I have actively kept a tally: I naturally use the mod operator an average of twice a calendar year, it has always been in personal life code when dealing with complicated geometry problems, the bit of code containing it almost always fails on some edgecase because at the point of using mod it is convoluted.
a % b = a - (b * a/b) /assuming a sane language with integer division, else cast a/b to int/
Figuring the above operation (or getting close) is when you should more or less pass, and That's a good point to show the interviewee what the operation is. That should be the point of an interview problem, to show the thought process, not that you know fancy tricks.
But alas, I was shown an XOR swap in an interview last week and spent 3 minutes deriving it on paper instead of 3 seconds saying "oh yeah, a => b and b => a" to a trick that I haven't seen since college some decade ago. The current market loves tricksters, I suppose.
And yes, the actual real world use of modulo is surprisingly sparse, despite easily imagining situations where you could use it.
``` float(9007199254740993) == int(9007199254740992) ```
If I need a "Non-Programmer Weed Out" question, I'd rather give a problem that is 1. as easy as FizzBuzz, but 2. is just 'if' statements and loops and cannot be solved by knowledge of a particular operator (or bit twiddling tricks).
We would both test the basics as well as go through with the candidate on how they think, how they collaborate, help them out if we felt nervousness was impacting them showing their skills, and in the end got a much better grasp on how skilled they were than if we were looking at Github repos or giving DS&A trivias to solve.
This is something I can easily solve in 5-10 minutes, correctly handling every plausible corner-case.
I'm curious how common this is, statistically speaking. I'm also curious how it correlates with other things about the interviewee.