# 136 Single Number
實際運用到 bitwise operators 的 ^,值得複習 !!
Given a non-empty 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?
input: 一個雙倍出現的數字 + 單獨出現的數字組成陣列
output: 找出那個落單的Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
*/
/**
* @param {number[]} nums
* @return {number}
*/
var singleNumber = function(nums) {}怎麼解
Last updated