You are given two integer arrays source and target, both of length n. You are also given an array allowedSwaps where each element allowedSwaps[i] = [] indicates that you can swap the elements at index source.
You may apply any number of swap operations on source using the index pairs from allowedSwaps in any sequence.
The Hamming distance between two arrays of equal length is defined as the total number of indices where their corresponding elements are not equal.
Return the minimum achievable Hamming distance between source and target after applying any number of swap operations on source.
Constraints:
n source.length target.length
n
source[i], target[i]
allowedSwaps.length
allowedSwaps[i].length
You are given two integer arrays source and target, both of length n. You are also given an array allowedSwaps where each element allowedSwaps[i] = [] indicates that you can swap the elements at index source.
You may apply any number of swap operations on source using the index pairs from allowedSwaps in any sequence.
The Hamming distance between two arrays of equal length is defined as the total number of indices where their corresponding elements are not equal.
Return the minimum achievable Hamming distance between source and target after applying any number of swap operations on source.
Constraints:
n source.length target.length
n
source[i], target[i]
allowedSwaps.length
allowedSwaps[i].length