My issue
In this problem there are some issue ,when I Write the same code in any other IDE it works and give proper output but here you can write anything it only give one output with every code. fix this bug as soon as possible.
My code
// Update the '_' to solve the problem
import java.util.*;
class Codechef {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
int size = read.nextInt();
ArrayList<Integer> list1 = new ArrayList<>();
for (int i = 0; i < size; i++) {
list1.add(read.nextInt());
}
ArrayList<Integer> list2 = new ArrayList<>();
for (int i = 0; i < size; i++) {
list2.add(read.nextInt());
}
HashSet<Integer> union = new HashSet<>();
for (int i = 0; i < list1.size(); i++) {
union.add(list1.get(i));
}
for (int i = 0; i < list2.size(); i++) {
union.add(list2.get(i));
}
System.out.println("Union of the lists: " + union);
}
}
Learning course: Learn Advance Java
Problem Link: CodeChef: Practical coding for everyone