• + 1 comment

    c# code for read input -> string[] ar_temp = Console.ReadLine().Split(' '); int[] ar = Array.ConvertAll(ar_temp,Int32.Parse);

    Java code for read input - > for(int ar_i = 0; ar_i < n; ar_i++){ ar[ar_i] = in.nextInt(); }

    You may have got the logic now, why he mentioned "Add directly to Set from read" - merge two forloops into one, this will give better performance.