Skip to content

Commit e263209

Browse files
committed
Time: 11 ms (81.28%), Space: 20.3 MB (57.1%) - LeetHub
1 parent 460fc37 commit e263209

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
int missingNumber(vector<int>& nums) {
4+
5+
int missing = 0;
6+
int n = nums.size();
7+
for (int i = 0; i <= n; i++) {
8+
missing ^= i;
9+
}
10+
for (int i = 0; i < n; i++) {
11+
missing ^= nums[i];
12+
}
13+
return missing;
14+
}
15+
};

0 commit comments

Comments
 (0)