Minimum array edit Algorithm
[challenge] Given the integer array a = [A1, A2, ···, an]. Your task is to do a series of operations on the array to make it non descending Group: in each operation, you need to select a number x, and then move all elements equal to X in the array to the beginning or end of the array Tail. For example, array a = [2, 1, 3, 1, 1, 3, 2] can be changed into a non descending array by the following two operations: 1. Move all elements equal to 1 to the beginning of the array to get [1, 1, 1, 2, 3, 3, 2] ; 2. Move all elements equal to 3 to the end of the array to get [1, 1, 1, 2, 2, 3, 3]. design an algorithm to calculate the minimum number of operations required to change a given array into a non descending array.