If you are here or this has come up in your search for solutions, you probably are having difficulty solving one of the beginner problems on CodeChef.com and hence have decided to google an answer to your frustrating dilemma.
In this blog I will try to provide an approach to solve the problem but it may not be the sole solution. There are many ways to solve it but I will cover only one method: a beginner’s method. Even though there are many examples you can dig from the pre-submitted answer in the answer page but none carry why, how of the coder thoughts and explanation.
I am only collecting beginner’s approach solutions into a blog so that you may be able to search the answer with an explanation as well.I will mainly focus on programming language Python as at present I am inclined towards it the most among Python, Java, and C++.