3 ms·
Someone complains about every possible interview question. This isn't the best, but it's not the worst, either, at least not if the interviewer expects a conve
by dpark 15y ago
Someone complains about every possible interview question. This isn't the best, but it's not the worst, either, at least not if the interviewer expects a conversation rather than a "perfect" answer.
If you fail the interview because you assumed "integer" meant the wrong thing, then maybe you deserved to fail. You should have asked what the interviewer meant. They could have meant mathematical integers (possibly only positive ones), 32-bit ints, 16-bit ints, "bignum"-style integers, etc. If you fail to ask for clarification, then at best you deserve to have the interviewer choose a different definition and then reveal that after you've wasted time assuming 32-bit ints. Ask for clarification and don't simply assume when there are multiple possibilities.
And you're neither correct nor especially clever for answering 2^32 if the interviewer tells you the question is about 32-bit unsigned ints. 2^32 is not a valid unsigned 32-bit int. This answer is either nonsensical or incorrect, depending on how we interpret it.