Well since you had already been discussing things with your friend (kudos for that instead of searching the web for answers!!) I think that it might be clear to you now, no?
It simply means that when repainting the cells the chef can choose to repaint 0 (case where he doesnt change color of any cell), 1,2… up to K cells with a different color according to the problem statement…
Please experiment with more test cases to understand yourself.
@kuruma Could you solve this doubt if it doesn’t violate any policy : Can a single square be repainted multiple times? Something like paint square 1 to color 4 and than paint the same square from color 4 to 6.
@kcahdog, I haven’t solved the problem yet, but, from what I’ve read, I think it’s not a very likely scenario, i.e. it might be possible, but, it might not be the best option or might not lead to best possible answer…
@kuruma In certain cases it could depending on the costs. However it is not possible to discuss test cases here. I asked the admin for clarification but none was given! Will read it again and try a fresh approach later.