Company: Flipkart
Difficulty: medium
Minimum Operations to Empty Array TeamId: 25849727 Given an array, A[] which consists of N integers. You can apply the following operation to it. For each operation select an integer X and perform exactly one of two actions after sorting the array in ascending order: Choose one index i (1≤i≤n) such that that |A[i]-X|≤1 and remove A[i] from the array. Choose two indices i and j (1≤i,j≤n,i≠j) such that |A[i]-X|≤1 and |A[j]-X|≤1 and remove A[i] and A[j] from the array. Find the minimum number of operations required to perform to make the array empty. Input Format The first line of the input contains one integer N representing the size of the array. The second line contains N space-separated integers representing elements of the array. Output Format Display the minimum number of operations required to perform to make the array empty. Sample Testcase #0