Get Min Operations
π Following is the original prompt - π₯
Devs at AMZ are working on a new sorting algorithm for points on the x-axis of the coordinate system.
There are n points. The ith point initially has a weight of weight[i] and is located at position i on the x-axis.
In a single position, the ith point can be moved to the right by a distance of dist[i].
Given weight and dist, find the minimum number of operations required to sort the points by their weights.
Function Description π₯
Complete the function getMinOperations2 in the editor -
GetMinOperations2 has the following arguments -
Returns
long int: the min num of operations to sort the points. Here long int represents a 64 bit integer. :)
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.