any another way to solve this algo??
without using Generic Heap??
can we use PriorityQueue??
solution is good, but it is too long
Can i solve it without Generic Heap?
@Vipin_coder
Yes ofcourse. It is entirely possible to solve this problem using PriorityQueue. However it would be a PriorityQueue of a pair object ( you would have to write pair class ) and you would also have to define the comparator function for it so as the PriorityQueue class can compare two different pairs.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.