You are given a list of integers of the same length
B. You are also given a two-dimensional list of integers
C where each element is of the form
[i, j] which means that you can swap
A[j] as many times as you want.
Return the maximum number of pairs where
A[i] = B[i] after the swapping.
n ≤ 100,000where
nis the length of
m ≤ 100,000where
mis the length of
A = [1, 2, 3, 4]
B = [2, 1, 4, 3]
C = [ [0, 1], [2, 3] ]
We can swap
can someone help me with the approach?