Array Homework Question

前端 未结 9 1263
庸人自扰
庸人自扰 2020-12-23 16:48

You are given an array with integers between 1 and 1,000,000. One integer is in the array twice. How can you determine which one? Can you think of a way to do it using littl

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 17:21

    Hint: Use the property that A XOR A == 0, and 0 XOR A == A.

提交回复
热议问题