This is not O(n). I think the for loop below will build a iterator which cost O(set.size())
for(int prefix : set)
Correct me if I'm wrong.
Maximum XOR of Two Numbers in an Array
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.