Quant, Math & Computer Science Puzzles for Interview Preparation & Brain Teasing
A collection of ~225 Puzzles with Solutions (classified by difficulty and topic)

Dec 28, 2009

Uniform Candy Distribution

Problem:
n children are sitting around a circular table. Each child starts out with an integer number of candies. The following step is repeated:
Every child who has an odd number of candies is given another piece of candy by the teacher. Each child now has an even number. Now every child passes half of his/her candy to the child on his/her left.

Prove that eventually all the children will have the same amount of candy.

Source: Puzzle Toad, CMU

Update (30/12/09): Solution: PDF Document from CMU Site

2 comments:

  1. It can be shown that the minimum of the number of candies with each kid strictly increases and the maximum of the number of candies with each kid strictly decreases after n rounds. Hence, after finite number of rounds, the min and max will meet and the process will stop.

    The formal proof using above method is a bit messy and I'll try for another approach before posting it.

    ReplyDelete
  2. anyine has easy solution than given one?

    ReplyDelete