Challenge Information

Title : arrange wooden sticks
Difficulty : Hard
Solutions : 6
Maximum Score : 200
Completed by You: No
Description :

Suppose you have a set of wooden sticks of various lengths. They've been set in a different order, and you've got to place them in the right order that's in ascending order. Only by switching the two sticks can you put them in proper order.

You need to compare the elements with the other elements on the right-hand side for sorting.

The function should return the total number of counts to sort the sticks.

Write a function solve that have the following parameter(s):
1.) arr = an array

Example
Input:
[5,7,4,3]
Output:
The function will return,
5.

Explanation First, consider 5 and compare them to the rest of the numbers on the right. 7 is greater than 5 so that we leave 7 and 4. 3 is smaller than 5 so that there would be 2 swaps.
=> 2

Second, we consider 7 and equate it to the rest of the right-hand side numbers, so 4 and 3 are both less than 7 so we'll add 2 in the previous 2 swaps.
=> 2+2

Last we compare 4 and 3 and so, 3 is less than 4 so we're going to add 1 to the previous 2.
=> 2+2+1

Constraints

Judocode