Skip to content

Commit acf4f3c

Browse files
committed
Create Single_Number.cc
1 parent e3c875d commit acf4f3c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Single_Number.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public:
3+
int singleNumber(int A[], int n) {
4+
// Note: The Solution object is instantiated only once and is reused by each test case.
5+
int ret = 0;
6+
for (int i = 0; i < n; i++) {
7+
ret ^= A[i];
8+
}
9+
return ret;
10+
}
11+
};

0 commit comments

Comments
 (0)