Number of Swaps


An array of distinct elements is given. Determine the minimum number of swaps required to sort the array in increasing order.

Write a function solve that have the following parameter(s):
1.) array of integer

Example
Input:
There is an array given:
[] = [3,2,7,9]
Output:
The function will return,
1

Explanation
Swap 2 by 3.

Constraints
• The number of elements in array will be greater than or equal to 1 and less than or equal to 102
• Each element in array will be greater than or equal to 1 and less than or equal to 104