Difficulty Comprehending Problem Arrfix SRM 696 Topcoder

Hello there ! I was trying problem here. I could not understand test case 3. If you could please help me understanding problem clearly?

You are given 3 arrays A, B and F. Let the length of F be m. Then we have to replace exactly m elements of A with m elements from F. So we cannot replace a particular element in A twice, and neither can we use an element from F to replace more than one value in A. We have to perform this in such a way that the number of indices where A[i] ≠ B[i] is minimized.

In test case 3, A={2,2,2}, B={2,2,2}, F={1,2,3}. The best way to perform these replacements will give us A={1,2,3} or A={3,2,1}. In both of these cases, A will differ from B at indices 0 and 2. So the answer is 2. For any other arrangement there would be different values of A and B at all 3 indices.

I hope you were able to understand!

1 Like