Sorting Sheet
Sorting Sheet
Given two arrays that have the same values but in a different order and
having no duplicate elements in it, we need to make a second array the
same as a first array using the minimum number of swaps.
Examples:
Input : arrA[] = {3, 6, 4, 8},
arrB[] = {4, 6, 8, 3}
Output : 2
Examples :
Input : arr[] = { 1 } and k = 1.
Output: 2
Input : arr[] = {1, 3}, k = 4.
Output : 6
(3) Choose k array elements such that difference of
maximum and minimum is minimized