Java Priority Queue Hackerrank Solution C