Can anyone please guide and help me correct my logic or approach ->Leetcode – 1942 (The Number of the Smallest Unoccupied Chair)
Can anyone please guide and help me correct my logic or approach. I looked at other’s solution, they are using 2 priority_queue, but I want to stick to my approach and me my mistake.
I have written my solution, my code works well but it has failed in some testcase, where vector times is very large and targetFriend=309, output=86, expected = 68.
My approach ->
Is std::std::priority_queue stable?
Is std::priority_queue stable? i.e., are the elements with the same priority are popped from the queue in the same order as they were in the container input to queue?