You are viewing a single comment's thread. Return to all comments →
Scanner input = new Scanner(System.in); PriorityQueue<Integer> pq = new PriorityQueue<>(); while(input.hasNext()){ int q=input.nextInt(); if(q==1){ pq.offer(input.nextInt()); } if(q==2){ pq.remove(input.nextInt()); } if(q==3) System.out.println(pq.peek()); } input.close();
Seems like cookies are disabled on this browser, please enable them to open this website
QHEAP1
You are viewing a single comment's thread. Return to all comments →