Apple Interview Question: You have a 100 coins laying f... | Glassdoor

Interview Question

Software Engineer Interview Cupertino, CA

You have a 100 coins laying flat on a table, each with a

  head side and a tail side. 10 of them are heads up, 90 are tails up. You can't feel, see or in any other way find out which side is up. Split the coins into two piles such that there are the same number of heads in each pile.
Answer

Interview Answer

33 Answers

42

Answer #1: Place 50 coins into two piles on its edges so that both have the same amount of heads in each pile, neither facing up or down.
Answer #2: Trick question, place 50 coins in both piles and in theory they all have heads just not necessarily facing up or down.

Luis Marquez on Jun 22, 2012
10

agree with 2nd ans

Anonymous on Jun 23, 2012
140

Split into two piles, one with 90 coins and the other with 10. Flip over every coin in the pile with 10 coins.

Anonymous on Jul 9, 2012
19

Just split into two piles, each with 50 coins. The question only asks 50 heads in each one, it doesn't ask for the number of heads up!!!

JianMin on Aug 29, 2012
6

Pick 10 coins from the pile, flip it and put it in the other pile. This will ensure that the number of heads up are equal in both the piles

Anonymous on Jan 16, 2013
73

Pick 10 coins from the original 100 and put them in a separate pile. Then flip those 10 coins over. The two piles are now guaranteed to have the same number of heads. For a general solution of N heads and a total of M coins:
1.) Pick any N coins out of the original group and form a second pile.
2.) Flip the new pile of N coins over. Done.

Example (N=2, M=6):
Original group is HHTTTT (mixed randomly). Pick any two of these and flip them over. There are only three possible scenarios:

1: The two coins you picked are both tails. New groups are {HHTT} {TT} and when you flip the 2nd group you have {HHTT} and {HH}.

2.) The two coins you picked consist of one head and one tail. New groups are {HTTT} and {HT} and when you flip the 2nd group you have {HTTT} and {TH}.

3.) The two coins you picked are both heads. New groups are {TTTT} and {HH} and when you flip the 2nd group you have {TTTT} and {TT}.

ishapiro on Mar 28, 2013
6

The question says "'You' can't feel, see or in any other way find out which side is up....' Can a team member? Cooperate with a fellow engineer, or other colleague, who can see the coins to solve the problem?

JennS on Jul 28, 2013
4

Question has its answer in it...
10 coins are head up.....
90 coins are tail down..... so it means all 90 coins are head up....

Now, all you have to do is to split it into half. 50/50

Gagan on Jul 29, 2013
3

Let's generalise the question to where there are n heads and any number of tails on the table.

Select any n coins. This set will contain m heads, where m is between 0 and n inclusive, and n - m tails. The other n - m heads will be in the remaining coins.

We now have two piles: the selection of n coins with n-m tails and the remainder with n-m heads. All we have to do is flip the selection so that the n-m tails become n-m heads, the same number as the heads in the remainder.

This is a straightforward extension of the 'pick any 10 coins and flip' answer correctly given above by several people.

Bootlebarth on Jul 29, 2013
4

All of you are over thinking it. Read the last bloody line,

"Split the coins into two piles such that there are the same number of heads in each pile"

They're not asking for the heads to be up or down, just an equal amount & every coin has a head side so dividing the pile equally achieves that.

addmony on Jul 29, 2013
2

100 coins total, 10 of them are heads up, 90 are tails up. Meaning all of them are heads up AND tails down. Split it 50/50 and you are done.

Daniel on Aug 8, 2013
5

It is not as easy as to just split it. And it says heads UP tails UP.
Given 10 h, 90 t. Pick some random 10 coins call it P1. Rest is P2.
In P1, (10-x) heads, (x) tails
In P2, (x) heads, (90-x) tails
Flip the coins in P1.
In P1, (x) heads and (10-x) tails
P1 and P2 have the same number of heads.

Shafiq on Nov 1, 2013
16

reading these answers is such a confidence builder.

trev on Feb 20, 2014
0

I agree to trev, don't think anyone read the question.

Anonymous on Aug 2, 2014
0

we already have 2 piles --> 90 coins with tails up and 10 coins with heads up, just flip over 10 of the coins from 90 coins that have tails up, we will have same number of coins with heads up in each pile.

bugaboo on Feb 27, 2015
1

get all coins in your hands, shake them, drop them.
for each coin there is a 50% probability to lay heads up, and 50% probability for tails down. now split i half

paninies on Apr 11, 2015
0

question doesn't need to look faces of which side is up after splitting it in two piles. split all coins in two part of 50 50 and they all have heads ...and thats what questioner asking..!

Kamal Bharakhda on Apr 14, 2015
0

and move them to the 10-coin pile.

Take 40 coins from 90-coin pile, flip them over on May 9, 2015
0

Take 40coins from 90-coin pile, flip them over and move to the 10-coin pile.

Anonymous on May 9, 2015
1

It's really depends on whether Apple is hiring Software Engineers who are collaborators, mathematicians or tricksters. It's clear that Apple does hire Engineers who listen to the question accurately.

Anonymous on Jun 18, 2015
1

Make two groups at random for 10 and 90 coins.

Example:-

               G1(10) G2(90)
case 1:- 6H,4T 4H,86T
case2:- 3H,7T 7H,83T

Now flip all coins of smaller group G1(10). The result will always have same Heads in each pile.

               G1(10) G2(90)
case 1:- 6T,4H 4H,86T
case2:- 3T,7H 7H,83T

Anonymous on Jul 19, 2015
0

We just get 5 coins head up put in each piles ==> we get the same number of head up in each pile. They just ask we "Split the coins into two piles such that there are the same number of heads in each pile" . They didn't say that we don't kow what is coin head up and they mixed together.

Tam on Sep 16, 2015
1

"The question says "'You' can't feel, see or in any other way find out which side is up....' Can a team member? Cooperate with a fellow engineer, or other colleague, who can see the coins to solve the problem?"

This is the best answer yet! Completely out of the box answer and yet so simple.

The M on Oct 3, 2015
0

Flip every other coin, 90 Tails will get split into 45 Heads and 45 Tails. Similarly 10 Heads will get converted to 5 Head and 5 Tails, so now we have 50 heads (45 + 5) and 50 tails (45 + 5). Then just split them into two equal groups.

Saurabh Pandit on Nov 17, 2015
1

Find complete answer with description here:

http://www.puzzlevilla.com/puzzles/puzzle/172

Interview Question on Nov 18, 2015
0

Answer

Tom on Nov 18, 2015
0

Make a pile of 10 and flip them over. Then the number of heads is equal in both piles.

Patrick on Nov 19, 2015
0

question says both group should have equal heads, but doesnt specifiy, it should be up, hence, just grouping 50 each would solve the problem

Panchaxari on Jan 19, 2016
0

This is a screw you question, but yeah if you take out 10 coins you can have anywhere between 0-10 heads for every head you have you have one less head in the other pile and one less tail in your pile of 10 coins.

So if you have 100 coins 10 heads and you take lets say 10 coins

0 heads, 10 tails. The 90 coins has 10 heads.
1 heads, 9 tails. The 90 coins has 9 heads (you stole one when selecting 10 coins).
2 heads, 8 tails. The 90 coins has 8 heads (same you stole 2 when selecting 10 coins ect).
3 heads, 7 tails. The 90 coins has 7 heads.
4 heads, 6 tails. the 90 coins has 6 heads.
5 heads, 5 tails, the 90 coins has 5 heads.
6 heads, 4 tails, the 90 coins has 4 heads.
7 heads, 3 tails, the 90 coins has 3 heads.
8 heads, 2 tails, the 90 coins has 2 heads.
9 heads, 1 tails, the 90 coins has 1 heads.
10 heads, 0 tails, the 90 coins has 0 heads.

As you can see whenever you take out 10 because your not only stealing from the pile of 90's heads your also offsetting the pile of 10 coins tails by 1 equally you have an equal connection between the tails you have in the pile of 10 coins as you do heads in the pile of 90 coins that your tails in 10 coins pile always equals heads in 90 coin pile. So you just flip over each coin in the pile of 10 coins and your tails becomes heads. So if you selected 1 head and in the 10 coins pile you had 9 heads in the 90 coins pile and 9 tails in the 10 coins pile, you are guaranteed after flipping each over once to have 9 heads in the 10 coins pile as tails becomes heads and 9 heads in the 90 coin pile, and ect, ect.

This stands true for any pile that you know the amount of one category and 2 options, If you know you have 25 of one things, despite how many things there are if each thing had only two options like heads or tails, you know selecting 25 of them the same amount you know of one thing that when taking out 25 or the equal number of what you know of one thing is in there that what you unsucessfully try to filter out is the inverse of what you selected successfully to take out.

Graham on Feb 19, 2016
0

Pick 10 coins, flip them and form a separate pile. The no.of tails in both pile will be equal inspite of your choice being a tails up coins or a heads up coins. Coz when u pick a tails up coin u r reducing the no.of tails up in the first pile and since u flip it its gonna b a heads up coin the second pile, if u r picking up a heads up a coin u turn it into a tails up coin in the second pile so that it can cancel out one tails up coin in the existing first pile.

Anonymous on May 13, 2016
1

If it means heads up then separate the coins into one pile of 90 one pile of 10 then flip the ten coins it works with all scenarios Of sides you ended up choosing also like to point out that we can't feel them so we probably can't use our hands to flip them but I assume they would allow us to use something as how else would we separate them

James on Oct 7, 2016
0

The answer lies in the exact wording of the question "Split the coins into two piles such that there are the same number of heads in each pile. " It does not specify heads need to be face up, so you would simply split the piles in 50 each and you have the same number of coins with heads in each pile.

Paul Ricci on Mar 27, 2017
0

Take ten coins (consider as one pile, Pile A and other 90 coins as another pile, Pile B).
Now you have two piles. Turn all coins as in pile A, you will end up with same number of heads in both piles.

Ex: Scenario 1: Consider in Pile A, there are 2 heads and 8 tails. Hence in Pile B there will 8 heads.Now when you turn all the coins in Pile A you will end with 8 heads in Pile A.
Hence both Pile A and Pile B have same number of heads.

Scenario 2: Consider in Pile A, there are 10 heads. Hence in Pile B there will be 0 heads.Now when you turn all the coins in Pile A, you will end with 0 heads in Pile A.
Hence both Pile A and Pile B have same number of heads.

Scenario 3: Consider in Pile A, there are 0 heads. Hence in Pile B there will be 10 heads.Now when you turn all the coins in Pile A, you will end with 10 heads in Pile A.
Hence both Pile A and Pile B have same number of heads.

Vamshi Nandan on May 18, 2017

Add Answers or Comments

To comment on this, Sign In or Sign Up.