rpisid
BAN USER- -4of 4 votes
AnswersWrite a function called FooBar that takes input integer n and prints all the numbers from 1 upto n in a new line. If the number is divisible by 3 then print "Foo", if the number is divisible by 5 then print "Bar" and if the number is divisible by both 3 and 5, print "FooBar". Otherwise just print the number.
- rpisid in United States
for example FooBar(15) should print as follows:
1
2
Foo
4
Bar
Foo
7
8
Foo
Bar
11
Foo
13
14
FooBar
I know, easy right? ;)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Brain Teasers - 3of 3 votes
AnswersYou have three jars filled with candies. One jar is filled with banana candies, one jar is filled with lemon candies and one jar has a mix of both. All the jars are mislabelled (i.e. all the jars have wrong labels about what kind of candies they contain).
- rpisid in United States
All the candies look very similar in shape, size and color and they even smell the same. The only way to distinguish them is by tasting.
You have to eat one and only one candy to determine the correct jar labels. You can eat that one candy from any jar you want as long as you eat only one in total.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Brain Teasers - 0of 0 votes
AnswersYou have perfect cubical blocks (i.e. each of the blocks has 6 sides)
- rpisid in United States
You have to make a calender display using those two cubes. So the task is to display the numbers 1 through 31 using the two cubes. For example you would make the date 13th by writing '1' on one cube and '3' on the other.
Only one digit can be written on each face of both the cubes. So there should be 6 numbers printed on each face of the two cubes.
How would you split and write the numbers on the two cubes such that all the numbers from 1 through 31 are displayed using them?| Report Duplicate | Flag | PURGE
Software Engineer Intern Brain Teasers
Determine the correct jar labels.
- rpisid November 14, 2013