first 7 Introductory problems
This commit is contained in:
23
CSES - CSES Problem Set/Missing_Number.cpp
Normal file
23
CSES - CSES Problem Set/Missing_Number.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Missing Number
|
||||
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
bitset<2 * (int)1e5> input;
|
||||
int n; cin >> n;
|
||||
for (int i{}; i < n; i++) {
|
||||
int a; cin >> a;
|
||||
input[a-1] = true;
|
||||
}
|
||||
input = ~input;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (input[i]) {
|
||||
cout << i + 1<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user