Company: Probo_4july
Difficulty: medium
Minimum Operations to Sort Array Problem Description You are given an array of n positive integers a 1 , a 2 , ..., a n . In one operation, you can do the following: Choose any integer x. For all i such that a i =x, do a i =0 (assign 0 to a i ). Find the minimum number of operations required to sort the array in non-decreasing order. Input Format The first line contains a single integer n - length of the array. The second line contains n integers a 1 , a 2 , ..., a n - an array. Output Format Print one integer - the minimum number of operations required to sort the array in non-decreasing order. Examples Example 1: Input: 3 3 3 2 Output: 1 Explanation: In the given test case, you can choose x=3 for the operation, the resulting array is [0,0,2]. Hence, the number of operations is 1. Constraints 1 <= n <= 10 5 1 <= a i <= n