The STL uses Red-Black trees for balanced tree work (at least the implementation that comes with g++). I don't recall if RB trees allow const time erases, but it could also be doing lazy deletes.
So, you want to get better at those tricky LeetCode Python problems, huh? It’s a common goal, especially if you’re aiming for tech jobs. Many people try to just grind through tons of problems, but ...