Java program for the above approach
import java . io . * ; import java . util . HashMap ; import java . util . Map ; import java . util . ArrayList ; import java . util . Collections ; class GFG { public static void minDeletions ( int arr [ ] , int N ) {