Count inversions in a sequence generated by appending given array K times
Given an array arr[], the task is to append the given array exactly K - 1 times to its end and print the total number of inversions in the resulting array. Examples: Input: arr[]= {2, 1, 3}, K = 3Output: 12Explanation:Appending 2 copies of array arr[] modifies arr[] to {2, 1, 3, 2, 1, 3, 2, 1, 3}The