We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I tried your suggestion, that is, I have implemented Comparable and Comparator at the Student class, as well as the mandatory methods of these 2 interfaces.
Also, I have instantiated the priority queue passing the student as an argument (the Comparator of the queue).
I could add the students to the queue and poll them from it. But, when I tried to print the names in list, the tests 3 and 5 have failed.
Any idea, my friend?
Best regards.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Priority Queue
You are viewing a single comment's thread. Return to all comments →
Hello silverdust,
I tried your suggestion, that is, I have implemented Comparable and Comparator at the Student class, as well as the mandatory methods of these 2 interfaces.
Also, I have instantiated the priority queue passing the student as an argument (the Comparator of the queue).
I could add the students to the queue and poll them from it. But, when I tried to print the names in list, the tests 3 and 5 have failed.
Any idea, my friend?
Best regards.