You are viewing a single comment's thread. Return to all comments →
public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); sc.nextLine(); List<Integer> li=Arrays.stream(sc.nextLine().trim().split(" ")).map(Integer::parseInt).collect(Collectors.toList()); int n=sc.nextInt(); while(n-->0){ sc.nextLine(); if(sc.nextLine().trim().equals("Insert")){ li.add(sc.nextInt(), sc.nextInt()); }else{ li.remove(sc.nextInt()); } } li.stream().forEach(ele->System.out.print(ele+" ")); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java List
You are viewing a single comment's thread. Return to all comments →