Apple Interview Question for SDE1s


Country: United States




Comment hidden because of low score. Click to expand.
6
of 12 vote

Split coins on two groups.
G1 = 10 coins; G2 = 90 coins
Coins can be distributed among the groups as follows

G1		G2
10H		90T
9H 1T	89T 1H
8H 2T	88T	2H
.
.
.
1H 9T	81T 9H
10T		80T 10H

So flip either group and then number heads should be equal.

- thelineofcode January 31, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Double check the question. It doesn't mention flipping~

Although I think it should. Then you get the right answer.

- chriscow January 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
-2
of 4 votes

I doesn't say that we can't flip coins either. If it mentioned flipping then it would suggest the solution. I believe it is not the intention of the interviewer to give tips in the question.

- thelineofcode January 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
-1
of 5 votes

Flipping either group doesn't work. It has to be the group with 10.

- Kyle March 16, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Split the coins into 50/50 piles randomly.
2. Flip over coins in one piles
3. Pick 25 coins each from the 2 piles to make a 50 coin pile, and the rest form another pile.

- Westlake February 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

The question didn't say "the same number of Heads up" in each pile. It just says the "same number of Heads" in each pile. Based on this requirement, divide the coins into 2 piles of 50 coins each. Both piles have the same number of heads

- Todd February 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Split the coins into two equal piles, coins have both a head and tails side. Thus making the piles equal in numbers of both heads and tails.

- Anonymous April 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If you have 10 heads in the 10 coin pile and you flip it, your test will fail.
Sorry guys, the one and only one right answer is:
pile all the coins in a 100 coins pile.
then cut int in half.

- asd November 30, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Just divide 100 coins into two halves.50-50. Both side will have same no. Of heads

- Mohan kurali January 25, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What if you want three groups? of equal number of heads.

- Rut May 09, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Out of three sites having this question, and approximately 40 answers, only Mohan and Anonymous got this right.

Nowhere do the instructions include the flipping of coins. Read precisely, simply separating the coins into two piles makes them even as to number of heads.

- Stephen Haven October 17, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Shove all 100 coins from table to the floor. Pick them up Head or Tail position that they fall down as. You will be able to tell if it is head or tail as you feel them when you pick them up. Place in 2 piles of 50 coins with 25 Heads and 25 Tails.

Alternatively you can just separate 50 coins on the floor, statistically you will be correct.

- justGuessing March 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Random split of 10 and 90, say pile A has random 10, pile B has random 90. This pile A now has random number of heads between 0 to 10. Assume pile A has X heads and 10-X tails. Then Pile B has 10-X heads.
Now flip pile A only. It should also now has 10-X heads..same as pile B. Thats it.

- Anonymous August 22, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Divide the 100 coins into two piles of 50 coins each and both will have equal number of heads because coins are fair with a head and tail. Catch: Question says Divide such that there are equal heads in both piles. It doesn't mention heads up.

- AS November 04, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Split total coins in to two piles with 50 coins. You will get same number of heads in both piles.

No thanks Please.

- AMIT December 01, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More