single number

来源:互联网 发布:数据分组分析法案例 编辑:程序博客网 时间:2024/04/30 15:22

题目:Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

思路:与操作,由于其他数都有2个,会抵消,最后得出的就是只出现一次的数,时间复杂度为n

0 0
原创粉丝点击