Brain Teaser

In my recent job search I was asked this question in an interview (I’m no longer in consideration for the position). I wondered if one of you more mathy types could demonstrate how you would solve it?

You are at a bakery, and you spend $20 on a total of 20 items, buying at least one of each. Fudges are $3, chocolates are $1, and candies are $0.50, how much of each did you buy?

1 Fudges = $3

15 chocolates = $15

4 candies = $2

how did you solve it FT?

edit: I can see how you can plug the answers to get it, but how can you solve it algebraically?

15 chocolate + 4 candy + 1 fudge

The way I did it was, you have to buy one of each, so that means $3 + $1 + .50 = $4.50 for 3 ,one of each

Then you ahve to buy another candy to make it make it a whole number.

Then you have $15 to buy the rest of the 16 items.

Fudge seems high priced and with price nearly the same as number of items, it’s out. I started with 15 chocolates and backed down to 14 chocolates with 2 candies to incrase my item count.

I think these questions are pointless and a waste of time.

Pretty easy.

Basically you have enough money to buy 20 chocolates and meet the requirements. But you need to buy at least one fudge as well. This leaves you with $17 and 19 items remaining. Or in other words, two dollars must be spent on candy to close the gap of money and items, which gives you 4 candy, and the remaining 15 chocolates.

I’m sure there is an easier mathematical derivation instead.

4 candies, 15 chocolate, 1 fudge. Solving for the two questions (3*fudge+1*chocolate+0.5*candies=$20 and fudge+chocolate+candies=20) gives you variables but there are three variables to solve for. But each variable is an integer, so you can create a minimum set of proportions that work and that’s 1:15:4. 1 fudge, 15 chocolates and 4 candies cost $20 and is 20 items. I think so anyway, since I’ve had a few…

Not sure how to solve it in my head. But there are two equations and three unknowns here. This suggests multiple answers (though it’s possible only one unique combination of integers has all numbers >= 1 and a sum = $20):

(x, y, z) = (# fudge, # chocolates, # candies)

x + y + z = 20 : you bought 20 items

3x + y + 1/2*z = 20 : the total bill added up to $20

Substituting eq 1 into 2 (I substituted y = 20 - x - z)

3x + (20 - x - z) + 1/2*z = 20 --> 2x - 1/2*z = 0 --> 4x - z = 0 --> z=4x

So whatever answer there is involves buying 4 times as many candies as fudge.

Allowable numbers of fudge are [1, 2, 3, 4, 5, 6] because 7 would cost more than $20. These would cost [$3, $6, $9, $12, $15, $18]

Corresponding numbers of candies would be [4, 8, 12, 16, 20, 24] and would cost [$2, $4, $6, $8, $10, $12]

Total sums of these pairs would be [$5, $10, $15, $20, $25, $30].

The last two would bust the budget. And the $20 wouldn’t let you buy any chocolate So the possible combinations involve (1,2,3) fudges and (4,8,12) candies, with the difference made up by chocolates (15, 10, 5).

(fudge, chocolate, candy)

(1, 15, 4) = ($3, $15, $2) = $20, 20 items

(2, 10, 8) = ($6, $10, $4) = $20, 20 items

(3, 5, 12) = ($9, $5, $6) = $20, 20 items

I would not be able to produce this answer without a sheet of paper, however.

Reading other people’s answers, the test was probably designed to see if you would follow the implied assumption that there was a unique answer or discover that there are multiple ones.

(or maybe they just wanted to know if you preferred to max out on fudge/candies, vs regular chocolate)

surprise

I just solved it mentally using the same logic as the posts below me but I knew that there were more than 1 answer.

did your interviewer expect you to do it in your head? or did he give you a pen?

I had a brainteaser filled interview once, but was handed a pen.

HACKSAW DETECTED!

Just kidding with you HP :wink:

This is basic utility maximization in economics, with the exception that there is no utility function. So there’s really no correct answer. There are many possible budget baskets, but whatever is optimal is whatever you decide it to be.

@BS : Nice to hear from you after a long time. Hope you get the job you are looking for…Best of luck.

Basic calculus that will give you a ratio of 1:4 for fudge to candy if you solve for chocolate. It did take me at least 3 minutes to jot it down on paper. Almost impossible without pen and paper, in an interview situation.

Boy am I glad I’ve never had one of these sprung on me in an interview. I think I would rather walk out than embarass myself trying to quickly come up with an educated guess.

Did you get a pen paper to solve this?

I got one at this interview I went for:

You have 25 horses labelled 1 to 25, and you need to find the 3 fastest amongst them and the only catch is that you can only make 5 run at a time. How many minimum number of races before you can find out the 3 fastest horses?

7 races

I get 7. Races 1 through 5 are the 5 unique groups of horses(1-5, 6-10, 11-15, 16-20, 21-25). Eliminate the 4th and 5th finishers from each group(for arguments sake, lets assume we numbered the horses correctly, so we’re eliminating #4,5,9,10,14,15,19,20,24,25).

Race 6 is the race winners.

Once you know the top 3 finishers from that winners heat(lets say it was horses 1, 6, 11), you can completely eliminate all the horses from groups 16-20 and 21-25, because at best, those horses would be the 4th fastest horse.

So we’re left with horses 1,6,11(the 3 fastest from the winners heat) as well as 2,3,7,8,12,13(the 2nd and 3rd place finishers from the heats of the remaining winners). But, we can eliminate a few other horses to. 12 and 13 are at best, the 4th fastest horse.

So now we’re left with 1, 6, 11, 2,3,7 and 8. If 1 is the fastest horse, we know that 8 is at best the 4th fastest, so she’s gone.

Now we’re down to 1,6,7,11,2,3. We know 1 is the fastest. So we take 2,3,6,7,11 and race them. The top 2 join horse #1 as the fastest 3.

I was outside having the interview over the phone. I will say, the pressure to produce an answer when this question is dropped on you casually in mid interview flow while the guy sits there silently is pretty intense.

@twicetheman: correct logic. I managed to answer 8 during the interview.