Company: User Submitted
Difficulty: medium
You are given an array A of permutations of integers from 1 to |A|. You can perform any number of swap operations in array A. In one swap operation, you can swap any two adjacent values. Now, your task is to find the minimum number of swap operations required to form subarray 1, 2, 3, .... i in the array A, for each 1 <= i <= |A|. Return an array B of size |A|, where B[i] denotes the minimum number of swap operations required to form 1, 2, 3, .... i, as a subarray in A. Problem Constraints 1 <= |A| <= 10^5 1 <= A[i] <= |A|