Alternate FizzBuzz Questions [closed]

2020-02-16 05:29发布

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.

标签: fizzbuzz
14条回答
2楼-- · 2020-02-16 05:45

I've found checking a string if it is a palindrome is a pretty simple one that can be a decent weeder.

查看更多
Rolldiameter
3楼-- · 2020-02-16 05:47

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.

查看更多
Fickle 薄情
4楼-- · 2020-02-16 05:48

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.

查看更多
老娘就宠你
5楼-- · 2020-02-16 05:54

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.

查看更多
该账号已被封号
6楼-- · 2020-02-16 05:55
做自己的国王
7楼-- · 2020-02-16 05:58

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:

Ask: show me (on paper, but better on a whiteboard) how you would swap the values of two variables.

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:

If they don’t start with creating a third variable, you can pretty much write that person off. I’ve found that I can cut a third to half my (admittedly at that point unscreened) applicants with that question alone.

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).

查看更多
登录 后发表回答