Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternate FizzBuzz Questions [closed]

Tags:

fizzbuzz

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.

like image 774
Andrew Burns Avatar asked Sep 22 '08 21:09

Andrew Burns


People also ask

What is the FizzBuzz question?

Fizz Buzz is a very simple programming task, asked in software developer job interviews. A typical round of Fizz Buzz can be: Write a program that prints the numbers from 1 to 100 and for multiples of '3' print “Fizz” instead of the number and for the multiples of '5' print “Buzz”.

How do you beat FizzBuzz test cases?

To pass the test you must write a function that accepts an integer and returns a string. Which string to return depends on the input number: If the integer is evenly divisible by three, it should return “Fizz”. If the integer is evenly divisible by five, it should return “Buzz”.

How do I fix my FizzBuzz problem?

Solution steps We run a loop from 1 to n and check divisibility by 3 or 5 or both. For i is divisible by both 3 and 5, we add string "FizzBuzz" at the ith index of the output string. Else, if integer i is divisible by 3, we add "Fizz". Else, if integer i is divisible by 5, we add "Buzz".

How do you FizzBuzz?

Players generally sit in a circle. The player designated to go first says the number "1", and the players then count upwards in turn. However, any number divisible by three is replaced by the word fizz and any number divisible by five by the word buzz. Numbers divisible by 15 become fizz buzz.


1 Answers

I've seen a small list of relatively simple programming problems used to weed out candidates, just like FizzBuzz. Here are some of the problems I've seen, in order of increasing difficulty:

  1. Reverse a string
  2. Reverse a sentence ("bob likes dogs" -> "dogs likes bob")
  3. Find the minimum value in a list
  4. Find the maximum value in a list
  5. Calculate a remainder (given a numerator and denominator)
  6. Return distinct values from a list including duplicates (i.e. "1 3 5 3 7 3 1 1 5" -> "1 3 5 7")
  7. Return distinct values and their counts (i.e. the list above becomes "1(3) 3(3) 5(2) 7(1)")
  8. Given a string of expressions (only variables, +, and -) and a set of variable/value pairs (i.e. a=1, b=7, c=3, d=14) return the result of the expression ("a + b+c -d" would be -3).

These were for Java, and you could use the standard libraries so some of them can be extremely easy (like 6). But they work like FizzBuzz. If you have a clue about programming you should be able to do most pretty quickly. Even if you don't know the language well you should at least be able to give the idea behind how to do something.

Using this test one of my previous bosses saw everything from people who aced it all pretty quick, to people who could do most pretty quick, to one guy who couldn't answer a single one after a half hour.

I should also note: he let people use his computer while they were given these tasks. They were specifically instructed that they could use Google and the like.

like image 99
MBCook Avatar answered Sep 28 '22 05:09

MBCook