Hello coders. I am a very beginner in competitive programming with very less knowledge of algorithm and data structures & problem solving skills. I was trying to solve the below question :
I was unable to come up with an efficient solution as my code was getting tle every time. So I just took a look on one of the successful submissions for this question. But I didn’t understand the approach.
Solution for the question is below :
int t, n, w, i, min, sum;
I am unable to think how they came up with the formula " sum-(n*min) ". Can some body please help me with this?
Thank you in advance. Please help.