← 返回 meta 的题目列表Minimum Movement Distance for Sorting
类型:online_judge
Given an unsorted array [5, 2, 2, 4, 3], transform it into a sorted array [2, 2, 3, 4, 5] and find the minimum movement distance.
The movement distance is defined as a single operation to move an element from one position to another. Output the minimum number of such operations required.
Example
Input
[5,2,2,4,3]