Java Priority Queue Hackerrank Solution