mirror of
https://github.com/20kaushik02/leetcode-gulag.git
synced 2025-12-06 11:34:07 +00:00
15 lines
236 B
C++
15 lines
236 B
C++
#include "soln.hpp"
|
|
|
|
int Solution::singleNumber(vector<int> &nums)
|
|
{
|
|
int uniq = 0;
|
|
for (int num : nums)
|
|
{
|
|
uniq ^= num;
|
|
}
|
|
return uniq;
|
|
}
|
|
|
|
bool Solution::test(vector<int>& nums, int answer) {
|
|
return singleNumber(nums) == answer;
|
|
} |