1. 程式人生 > >【Leetcode】Day1 Singular number

【Leetcode】Day1 Singular number

leet exc one 刷題 占用 nbsp 數組 tps https

  開個貼記錄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/

  我的方法:

  

【Leetcode】Day1 Singular number