Rearrange an array of integers so that the calculated value U is maximized. Among the arrangements that satisfy that test, choose the array with minimal ordering. The value of U for an array with n elements is calculated as : code example
Example: if(arr[i]==k) return arr[i];
if(arr[i]==k){
return arr[i];
}