25 kids were in a class, they were all trading lunches.

  • Each kid traded their lunch 5 times.

  • At first 12 kids had bananas.

  • At first 13 kids had oranges

  • 16 kids like bananas

  • 14 kids like oranges

  • In the end 9 people threw out their lunch because they never liked it

So the question is, what's the maximum number of people who could have oranges after this trade?

  • $\begingroup$ Have as in have in their hands or had it for lunch? $\endgroup$ – skv Oct 31 '14 at 13:21
  • 1
    $\begingroup$ Everything in this puzzle seems like red herrings. I would guess that 13 kids could have oranges at most, unless those 13 kids had more than one orange each, in which case the maximum could be 25. $\endgroup$ – Trenin Oct 31 '14 at 13:21
  • 1
    $\begingroup$ @warspyking - Are you making these things up or delivering them transcribed from another source? If you make them up, how do you validate your puzzles as answerable, and your answers as unique? $\endgroup$ – wbogacz Oct 31 '14 at 13:26
  • $\begingroup$ @Trenin no, because 9 kids threw their lunch out. If 13 orange-likers had oranges, and 12 banana-likers had bananas (the best distribution) nothing would be thrown out. $\endgroup$ – Kate Gregory Oct 31 '14 at 13:27
  • $\begingroup$ @warspyking Does every kid like something? Can there be kids who like neither? Because there are two different answers... $\endgroup$ – Trenin Oct 31 '14 at 14:13

Edit: This answer assumes that every kid likes something - i.e. there are no kids that like neither bananas or oranges. If this assumption is wrong, then @RTL posted a great solution.

So $11$ kids like bananas, $9$ kids like oranges, and $5$ kids like both. Regardless of how it is setup, the $5$ that like both will never discard their lunch. Since they are guaranteed, lets give them all oranges.

Now we have $8$ oranges left and $12$ bananas. If we try to give every kid what they want, then we will have $8$ kids happy with oranges, $11$ kids happy with bananas, and $1$ kid unhappy about having a banana when he wants an orange.


  • $8$ kids who like oranges have them
  • $11$ kids who like bananas have them
  • $5$ kids who like both have oranges
  • $1$ kid who likes oranges has a banana

If we swap the lunches of $4$ kids who like oranges with $4$ kids who like bananas, then we will have $9$ kids who were unhappy with their lunch and throw them out.


  • $4$ kids who like oranges have them
  • $7$ kids who like bananas have them
  • $4$ kids who like bananas have an orange
  • $5$ kids who like oranges have a banana
  • $5$ kids who like both have oranges

Since we don't know the original configuration, we can assume that whatever it was, it was $5$ trades away from this configuration. Otherwise, we would need to know the staring configuration to see if we can get to this optimal one.

For example, lets assume that the orange loving kids are numbered $1-9$, the banana lovers are numbered $10-20$, and those that love both are $21-25$. The final configuration we want is:

|-----orange lovers-----| |-------banana lovers----------| |-love both--|
|---eat--|  |------throw out--------| |----------------eat--------------|
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
o  o  o  o  b  b  b  b  b  o  o  o  o  b  b  b  b  b  b  b  o  o  o  o  o

Then, shift everything to the left by 5 wrapping around and we would have the following:

|-----orange lovers-----| |-------banana lovers----------| |-love both--|
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
b  b  b  b  o  o  o  o  b  b  b  b  b  b  b  o  o  o  o  o  o  o  o  o  b  

Now, this is the original configuration. To get to the optimal one in 5 trades, everyone gives to the one on their right and takes from the one on their left. Everyone is involved in $5$ 25-way trades.

If you need it to be a 2-way trade (i.e. a trade is only between 2 kids), then there is no answer. Lets say that a trade is made up of two half trades. Each kid is involved in 5 half trades. Since their are 25 kids, there is 125 half trades. But a trade has 2 half trades, so there is no way to come up with exactly 125 half trades since it is odd.

Answer: $9$ kids can have oranges.

| improve this answer | |

The maximum is $13$, the original number of oranges... (if we "optimise" for most oranges)

As the number of swaps is irrelevant as we have no information on this distribution of bananas and oranges to the likes and dislikes so we can set them up for our "perfect" solution. (We can just set the results and work backwards to define the distribution based on that)

The solution

  • $16$ kids like bananas

Now we choose that

  • $13$ of these banana liking kids also like oranges,

this gives

  • $8$ who will always throw there fruit away
  • $3$ who only like bananas
  • $13$ who like both oranges and bananas
  • $1$ who only likes oranges

Now at the end we can set it such that:

The $8$ who like neither fruit and the $1$ who only likes oranges all get bananas

  • This gives the $9$ pieces of fruit thrown away (all bananas)

There are now $3$ bananas and $13$ oranges left

  • The $3$ who only like bananas get the $3$ remaining bananas
  • The $13$ who like both get the $13$ oranges
| improve this answer | |
  • $\begingroup$ You beat me to this... I might also add that it works for 14 kids who like both, 2 who like bananas only, and 9 that like neither. $\endgroup$ – Warlord 099 Oct 31 '14 at 14:11
  • $\begingroup$ Interesting - I assumed that their are 3 groups - kids who like bananas, kids who like oranges, and kids who like both. You've created a 4th group of kids who like neither. $\endgroup$ – Trenin Oct 31 '14 at 14:12
  • $\begingroup$ @Warlord099 I started with that but I ended up changing it while writing it up for some reason... (I believe I make a little mistake which made me think I had to throw an orange away). But that is correct, 9 bananas thrown by the neither-likers, 1 of the both-likers and the 2 bananas-likers get the remaining 3 bananas , leaving 13 both-likers with oranges... $\endgroup$ – RTL Oct 31 '14 at 14:19
  • $\begingroup$ I wish I could accept both answers, but I meant like @Trenin said for 3 groups. I will upvote though! $\endgroup$ – warspyking Oct 31 '14 at 15:43
  • $\begingroup$ @warspyking Seems fair, I fully expect this to happen on many puzzles, due to different interpretations of the rules... $\endgroup$ – RTL Oct 31 '14 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.