//idea: use appropriate data structure such as hash table public class P1{ static void fun(int[] arr, int N){ Map map = new HashMap(); for(int i=0;i