3 ms·
No, it does not get you "instantly disqualified". I think if an interviewer posed that question to you exactly as stated, namely with a 100 numbers, they would
by anyfoo 8y ago
No, it does not get you "instantly disqualified". I think if an interviewer posed that question to you exactly as stated, namely with a 100 numbers, they would tell you that you did a good job and solved the problem in a perfectly reasonable way.
So now that we've set the scene, let's scale for a million numbers, rounding up to 2^20. The existing solution needs at least an extra megabyte (since you are not setting individual bits, it will be at least a byte per number), and a second pass of scanning through that entire megabyte. Fine in a web application, maybe not so much in an embedded system kernel. How can we improve?
And so we got a discussion started.
I personally would not ask that question, since it's really a bit too generic, but you get the gist: Start out with something that sets the scene (and catch unqualified people really early), and opens up discussion for more and more interesting discussions.