Skip to content

Commit 1bd25f1

Browse files
committed
Rename problem17.cpp to problem17Sol2.cpp
1 parent fbfc425 commit 1bd25f1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

problem17Sol2.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//Solved by Sri Divya, CSE
2+
3+
#include <iostream>
4+
using namespace std;
5+
6+
int missing(int a[], int len)
7+
{
8+
int xor_res = 0;
9+
for(int i = 0; i < len; i++)
10+
xor_res ^= a[i] ^ (i+1);
11+
return xor_res ^ (len+1);
12+
}
13+
14+
int main()
15+
{
16+
const int nplus1 = 13;
17+
int a[nplus1-1] = {4,5,3,2,8,9,10,11,7,1,12,13};
18+
cout <<"Missing = " << missing(a, nplus1-1)<<endl;
19+
return 0;
20+
}

0 commit comments

Comments
 (0)