mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-26 04:12:00 +00:00
14 lines
276 B
C++
14 lines
276 B
C++
|
class Solution {
|
||
|
public:
|
||
|
int getMissingNumber(vector<int>& nums) {
|
||
|
set<int> s;
|
||
|
for (int i = 0; i <= nums.size(); i++) {
|
||
|
s.insert(i);
|
||
|
}
|
||
|
for (int i : nums) {
|
||
|
s.erase(i);
|
||
|
}
|
||
|
return *s.begin();
|
||
|
}
|
||
|
};
|