Xor fails on triples
transcript
Each id appears three times. One id appears once. Xor worked for pairs.
The feed is two, two, three, two. Three twos do not cancel under xor. One two is left behind. Xor of the feed is one. The lone id is three.
Xor cancels a value seen twice. It does not cancel a value seen three times. A count modulo three does.
Ones holds bits seen once more. Twos holds bits seen twice more. A bit seen three times is cleared.
A feed can hold 300,001 alerts. Two integers are enough. No map is needed.
Xor cancels a value that appears twice. A triple leaves one copy behind. So we need a count modulo three.
Run the feed two, two, three, two. Xor of the whole feed gives one. The count modulo three gives three. Always test a trick on a small feed first.
Pairs need xor. Triples need two integers. Full breakdown in the lecture.