Minimum number of swaps needed to change Array 1 to Array 2?

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2010-06-07T07:00:15Z Indexed on 2010/06/07 7:02 UTC
Read the original article Hit count: 195

Filed under:

For example, input is

Array 1 = [2, 3, 4, 5]
Array 2 = [3, 2, 5, 4]

Minimum number of swaps needed are 2.

The swaps need not be with adjacent cells, any two elements can be swapped.

© Stack Overflow or respective owner

Related posts about algorithm