Chocolate Distribution Program
Manoj is a teacher in a government school. He has 10 students in his class sitting in a straight line, which he represents as array elements, now he wants to distribute chocolates to all of them. So he devices a algorithm where students compete with one another to get chocolates from Manoj. Having chocolates is represented as 1 and not having chocolates is represented as 0. if the student is at a or a[last] position they only have one neighbour thus, in this case consider such non existent neighbours to be not having any chocolates.
Algorithm looks something like this: If on any given day, if a student’s neighbours(both on left and right)
- Both have chocolates or both don’t have chocolates
Then, he will get chocolates the next day.
EXPECTED RETURN VALUE: