Chef and Equality - what is considered one operation?

I was really confused about how Chef and Equality is supposed to work, and looking at the comments just made me more confused. Someone asked if the program was supposed to count number of piles that need to be changed, or number of operations (something I was wondering as well) and the response was “Question clearly mentions that you need to find the minimum number of operations needed.”

Okay, but what’s one operation? At first I thought it meant one coin could be taken or given at a time, but later there was a clarification posted that said “In the sample case… suppose you want to make all piles to size 1, then remove 1 coin from pile 2 and put it in the box, remove 2 coins from pile 3 and put it in the box and remove 3 coins from the 4th pile and put it in the box… So in 3 operations all piles become equal having 1 coin each…” which I guess means that any operation can add or remove as many coins as needed. Wouldn’t that make the amount of operations needed and the number of piles needed to be changed the same thing? Am I misunderstanding something here?

After reading the problem statement i had same doubt but by looking at test cases and explanation i got the point, so i would like to share with you what i understand by test cases.

1 2 3 4


Actually we have to count the how many piles we have to change in order to get equal number of coins in each pile. So yes amount of operations needed and the number of piles needed to be changed are same thing…

Hope your doubt is clear… :slight_smile:

Best of Luck… :slight_smile:

Yes, this is the meaning of it, got AC using this logic.