I am kind of new here and not sure if it is ok to ask such things here. I was getting WA in 651B - Beautiful Paintings and check someone else's code. I saw they just checked the max number of times any integer was repeated and deducted that number from the original input of test cases.
Suppose the input for cases was 5, the numbers were 100,100,100,200,200. the maximum amount of time one number was repeated is 3, coz 100 was repeated 3 times. so, 5-3 = 2, which is the number given as the answer and that is the correct answer.
But the problem is, I don't understand why this approach works. Can anyone help me with this?







