Approach hintTry it first, then revealHide
Insert numbers as 30-bit paths into a binary trie with a counter on every node, so removal just decrements counts. For a query, step to the opposite bit whenever that child's count is positive.
Insert numbers as 30-bit paths into a binary trie with a counter on every node, so removal just decrements counts. For a query, step to the opposite bit whenever that child's count is positive.