codingChallenge
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user