Skip to content

Commit 253ae57

Browse files
committed
Final solution
1 parent 7248f92 commit 253ae57

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

C++/Arithmetic Number.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using namespace std;
55

66
int inSequence(int a, int b, int c)
77
{
8-
if (c == 0)
8+
if (c == 0 )
99
{
1010
if (a != b)
1111
{

C++/Single Number.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
#define lld long long int
4+
5+
6+
int singlenumber(int arr[],int n)
7+
{
8+
int ans=0;//we will use the xor property stating that xors of 2 same numbers is 0
9+
for(int i=0;i<n;i++)
10+
{
11+
ans=ans^arr[i];
12+
}
13+
return ans;
14+
15+
16+
17+
18+
19+
}
20+
21+
22+
23+
24+
int main()
25+
{
26+
return 0;
27+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
#define lld long long int
4+
5+
void sort012(int arr[],int n)
6+
{
7+
int temp[3]={0};//we will apply count sort so its the storing array
8+
9+
//traversing over the array and will increase the suitable index value
10+
for(int i=0;i<n;i++)
11+
{
12+
if(arr[i]==1)
13+
{
14+
temp[1]++;
15+
}
16+
else if(arr[i]==0)
17+
{
18+
temp[0]++;
19+
}
20+
else
21+
{
22+
temp[2]++;
23+
}
24+
}
25+
int i=0;
26+
while(arr[0]>0&&i<n)
27+
{
28+
arr[i]=0;
29+
arr[0]--;
30+
i++;
31+
}
32+
33+
while(arr[1]>0&&i<n)
34+
{
35+
arr[i]=1;
36+
arr[1]--;
37+
i++;
38+
}
39+
40+
while(arr[2]>0&&i<n)
41+
{
42+
arr[i]=2;
43+
arr[2]--;
44+
i++;
45+
}
46+
47+
48+
49+
50+
51+
52+
}
53+
54+
55+
56+
57+
58+
int main()
59+
{
60+
return 0;
61+
}

0 commit comments

Comments
 (0)