It shows tle .Plzz help me to optimise this code
Strongest Fighter Problem
Try to think this using priority queue or heap if you are familiar with it. If not let me know, will help you accordingly.
No, I am not familiar with it
Have you read about priority queue? If not i would suggest you to first read it or watch it’s video, then try to solve it. But if you still wants to do it now, let me know will help you with priority queue approach.
Though it can be solved using deque with optimised version attached below
You can refer to this too
Since you are familiar with deque so implement it.
My approach is wrong??
I’m just asking since I feel lack of confidence while solving problems
Your approach is right, no doubt in that. It’s just not optimize. The deque code which i have provided you is of O(n) whereas your was O(n*k) so just to optimise it. Try to implement it like this. Rest everything is good.
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.
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.