你有一个n = 2k + 2个元素的数组,其中2个元素没有配对.8个elemets数组的示例:1 2 3 47 3 1 2 0."47"和"0"没有数组配对.如果我有只有1个元素没有配对的数组,我用XOR解决了这个问题.但我有2个不配对的元素!我能做什么?解决方案可以是O(n)时间性能和O(1)额外存储器.
c algorithm discrete-mathematics array-algorithms
algorithm ×1
array-algorithms ×1
c ×1
discrete-mathematics ×1