I tried to find solutions in JS online with no luck.
No good priority queue implementation of JS found that has a 'remove' method.
Tried to solve it using an online implementation of BST which should has O(logN) time complexity for both finding maximum and removing elements, as oppose to Priority Queue's O(1) for finding maximum and O(n) for removing elements. Yet I still got TLE.
Does anyone solve this problem using JS? Could you please share your solution?