google Coding Challenge ( August 23rd)

I got this question in Google coding challenge ,

Print the Minimum hamming distance between array A and B possible by swaping any number of times ,the given indices in Array A.

Input :
Array A: 8 8 6 5 4 8
ArrayB: 5 3 8 2 6 8

Swapabble Indices :
(6, 1) ,(4,5),(6,3),(2,1),(2,4) .

Can someone provide me the optimal approach for this problem.
I could only provide partial solution to this problem for all the test case.

Thanks in Advance.

Comments (1)