the number of candies with a student is odd. however, the key idea remains the same.
let us assume the no. of students be n and each student has even no. of candies.let it be 2m, 2m+2, 2m+4, 2m+6, 2m+8, 2m+10, 2m+12, 2m+14, 2m+16, 2m+18, 2m+20...and so on.also,suppose the students are sitting in the clockwise manner.now,after every whistle a student passes half of his candies to the student on his left and if the student has an odd no. of candies then he gets an extra candy from the teacher.lets start with the student having 2m candies.he will pass m candies to the student having m+1 candies.this student passes his m+1 