Browsing Wikipedia and reading some random references are the best way to write problems.
Find a subset S ∈ {1, 2, . . . , n} such that:
- For all pairs (a, b) such that a, b ∈ S and a < b, the values of bitwise XOR of a and b should be distinct.
- |S| ≥ ⌊√(0.5n)⌋.