Anybody have any good FizzBuzz type questions that are not the FizzBuzz problem?
I am interviewing someone and FB is relatively well known and not that hard to memorize, so my first stop in a search for ideas is my new addiction SO.
Anybody have any good FizzBuzz type questions that are not the FizzBuzz problem?
I am interviewing someone and FB is relatively well known and not that hard to memorize, so my first stop in a search for ideas is my new addiction SO.
I've found checking a string if it is a palindrome is a pretty simple one that can be a decent weeder.
How about: I want to use a single integer to store multiple values. Describe how that would work.
If they don't have a clue about bit masks and operations, they probably can't solve other problems.
Find a list of primes is a fairly common question but it still requires some thought and there are varying degrees of answers people might give.
You would also be surprised how many people struggle to implement a Map/Dictionary type data-structure.
Fibonacci, reverse a string, count number of bits set in a byte are other common ones. Project Euler also has a large collection of increasing difficulty.
Check out 6.14 from the C++ FAQ Lite:
http://www.parashift.com/c++-faq-lite/big-picture.html
For something really super-simple that can be done in 10 seconds, but would remove those people who literally can't program anything, try this one:
This wasn't my idea, but was posted in a comment by someone named Jacob on a blog post all about the original FizzBuzz question.
Jacob goes on to say:
There is a further interesting discussion after that comment on the original blog post about ways to perform this variable swapping without requiring a third variable (adding/subtracting, xor etc.), and of course, if you're using a language that supports this in a single statement/operation, it may not be such a good test.
Although not my idea, I wanted to post this here as it's such an elegantly simple, easy question that can (and should) be answered within about 10 seconds by someone who has written even the simplest of programs. It also does not require the use of somewhat apparently obscure operators like the modulo operator, which lots of people, who are otherwise fairly decent programmers, are simply not familiar with (which I know from my own experience).