Problem Link


Java PriorityQueue



import java.util.*;

public class Main{

public static void main(String[] args){

Scanner sc=new Scanner(System.in);

PriorityQueue<Integer> mH=new PriorityQueue<Integer>();

int n=sc.nextInt();

while(n– >0) {

int x=sc.nextInt();

if(x==1){ mH.offer(sc.nextInt()); }

else if(x==2) { mH.remove(sc.nextInt()); }

else{ System.out.println(mH.peek()); }





About waprogramming

I am in CSE,from CUET
This entry was posted in Hackerrank, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s