Hot Chilli Problem!

In Design and Analysis of Algorithm class, ma’am walked into the class with a champagne glass with a couple of candies in it. The first thing that came in my mind was that there could be a quiz session today with chocolates as the winning prize. Little did I know there was a chilli in the glass as well. Ma’am asked the class if there was any student who would accept a challenge, where the loser had to eat hot chilli. Everyone hesitated to accept the challenge because of the chilli. I wondered what challenge could it be. To break my train of thoughts ma’am carried on explaining the challenge.

She said, “The aim of the challenge is to not be left with the chilli at the end.” She also said that she would always go first, and you can take only one, two or three candies at a time. Each player takes on their turn, between one and three chocolates. So Gautam from our class volunteered to take up the challenge and the game begun. We were watching intently as to see who would win. Unfortunately for Gautam, he was left with the chilli. Many of them wanted to challenge ma’am since they wanted to win, but they lost. I was curious as to how ma’am always managed to win this game. I thought there had to be a strategy for ma’am to achieve victory each and every time.

As I had thought of it, there was indeed an algorithm behind the victory. Bharath from my class was the one who came up with the solution. So, there were 13 chocolates and one chilli in the glass. He said, “The key here is to think about grouping things in fours. 13 chocolates divides into three groups of four, with one left over. So, by taking one chocolate in the first round and then four minus whatever the other player takes in the subsequent rounds, this algorithm ensures that the other player is always left with the chilli.”  It was that simple. The essence of a really good algorithm, its magic, if you like, is mathematics.

Certain problems are hard to solve, but there is solution to each and every problem. It is fascinating because we never run out of problems so there are always new interesting things to learn and implement it. Robert H. Schuller said, ”Never underestimate your problem or your ability to deal with it.” Indeed, we all need to understand our skills and try our best to implement it. Overall I enjoyed the game as well as trying to solve it and I am looking forward to solve more interesting problems .

Author- Kavya Reddy

Leave a comment