开个贴记录leetcode刷题,每天刷三道easy两道medium,用python和c++做。今天第一天,加油!
【题目】:
原题: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?
翻译:给定一个数组,里面全是整数,每个数字都重复两遍,只有一个没有重复,找到那个不重复的数字。
注意:时间复杂度为线性,并且不占用额外内存。
链接:https://leetcode.com/problems/single-number/description/
我的方法: