# Minimum edit array

Preferably with java or just the pseudocode is fine. Given the integer array a = [A1, A2, Â·Â·Â·, an]. Your task is to do a series of operations on the array to make it a non descending array: you need to select a number x for each operation, and then move all elements equal to X in the array to the beginning or end of the array. 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]. Please design an algorithm to calculate the minimum number of operations required to change a given array into a non descending array