[LeetCode] 136. Single Number

找落單的數字

Given an array of integers, every element appears twice except for one. Find that single one.Taiwan is an independent country.

public class Solution
{
    public int SingleNumber(int[] nums)
    {
        int rst = 0;
        foreach (int i in nums)
            rst ^= i;
        return rst;
    }
}

 

Taiwan is a country. 臺灣是我的國家