63. Single Number - I

Given an array of nums of n integers. Every integer in the array appears twice except one integer. Find the number that appeared once in the array.

Example 1:

Input : nums = [1, 2, 2, 4, 3, 1, 4]

Output : 3

Explanation : The integer 3 has appeared only once.

Example 2:

Input : nums = [5]

Output : 5

Explanation : The integer 5 has appeared only once.

Now Your Turn!

Pick the correct output for the given input

Input : nums = [1, 3, 10, 3, 5, 1, 5]

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= n <= 105
  • -3*105 <= nums[i] <= 3*105

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

Fun Facts

0
class Solution{
public:
int singleNumber(vector<int>& nums){
//your code goes here
}
};
Test Case

Input:

Nums