Binary Search on Trees
I did this through a Codeforces problem, rated 1500.
https://codeforces.com/contest/2001/submission/278198746
Essentially, you can maintain 2 different sets.
and like incrementaslly adding components
Thereās this problem that is also interesting