I am pasting my code below, please let me know for which 1 test case is it failing:
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
n = Math.abs(n);
ArrayList<Integer> arr = new ArrayList<>();
for(int i = 0; i<n; i++){
if(sc.hasNextInt()) arr.add(sc.nextInt());
}
int target = 0;
if(sc.hasNextInt()) target = sc.nextInt();
for(int i=0; i<arr.size();i++){
if(arr.contains(target - arr.get(i))){
if(arr.get(i)<=(target - arr.get(i)))
System.out.println(arr.get(i) +" and "+ (target - arr.get(i)));
}
}
}
}