You are viewing a single comment's thread. Return to all comments →
My Java solution
public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); PriorityQueue<Integer> pQueue = new PriorityQueue<Integer>(); for(int i = 0; i < n; i++) { int q = sc.nextInt(); switch(q) { case 1 : pQueue.add(sc.nextInt()); break; case 2 : pQueue.remove(sc.nextInt()); break; case 3 : System.out.println(pQueue.peek()); break; } } } }
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 →
My Java solution