codingChallenge

This commit is contained in:
2024-09-18 21:08:39 -04:00
parent 52f6f2a1a8
commit afc94ab8a8
9 changed files with 99 additions and 11 deletions
+29
View File
@@ -0,0 +1,29 @@
import java.io.*;
import java.util.*;
public class JavaList {
public static void main(String[] args) {
/*
* Enter your code here. Read input from STDIN. Print output to STDOUT. Your
* class should be named Solution.
*/
List<Integer> L = new ArrayList<>();
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number of Queries: ");
int Q = scan.nextInt();
while (Q-- > 0) {
int N = scan.nextInt();
L.add(N);
}
int x = scan.nextInt();
int y = scan.nextInt();
L.add(x, y);
int xagain = scan.nextInt();
L.remove(xagain);
for (int i = 0; i < L.size(); i++) {
System.out.print(L.get(i) + " ");
}
scan.close();
}
}