*
ALL
Given an array of integers, any array
element can be moved to the end in one
move. Determine the minimum number of
moves required to sort the array, ascending.
11 Complete the 'getMinimu
12.
13 * The function is expecte
14 * The function accepts IN
15 */
16
17 int getMinimumMoves (vector
18
19 }
20
21 > int main()
Example:
arr = [5, 1, 3, 2]
6
e
7
Move the value arr[2] = 3 to the end to get
arr = [5, 1, 2, 3).
• Move arr[0] = 5 to the end to achieve the
sorted array, arr = [1, 2, 3, 5).
• The minimum number of moves required to
sort the array is 2.
9
10
Function Description
Complete the function getMinimum Moves
in the editor below.
Attachments:
Answers
Answered by
0
Answer:
ALL
Given an array of integers, any array
element can be moved to the end in one
move. Determine the minimum number of
moves required to sort the array, ascending.
11 Complete the 'getMinimu
12.
13 * The function is expecte
14 * The function accepts IN
15 */
16
17 int getMinimumMoves (vector
18
19 }
20
21 > int main()
Similar questions