code: https://ide.codingblocks.com/s/429769
prob: https://hack.codingblocks.com/app/contests/2022/1603/problem
why isn’t my compare class working like it should
code: https://ide.codingblocks.com/s/429769
prob: https://hack.codingblocks.com/app/contests/2022/1603/problem
why isn’t my compare class working like it should
I can’t see use of your comparator function in your code. Also try to submit this problem on leetcode as it will be more convenient for you to understand it.
Leetcode link->
compare function is used because without it the priority queue works for int only
But you haven’t initialized your priority queue with it, you should initialised it like this
You can try to implement it like this also
It’s totally up-to you.
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.