forked from ArmanKumar21/python-cpp-html-programs-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7248f92
commit 253ae57
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ using namespace std; | |
|
||
int inSequence(int a, int b, int c) | ||
{ | ||
if (c == 0) | ||
if (c == 0 ) | ||
{ | ||
if (a != b) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
#define lld long long int | ||
|
||
|
||
int singlenumber(int arr[],int n) | ||
{ | ||
int ans=0;//we will use the xor property stating that xors of 2 same numbers is 0 | ||
for(int i=0;i<n;i++) | ||
{ | ||
ans=ans^arr[i]; | ||
} | ||
return ans; | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
int main() | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
#define lld long long int | ||
|
||
void sort012(int arr[],int n) | ||
{ | ||
int temp[3]={0};//we will apply count sort so its the storing array | ||
|
||
//traversing over the array and will increase the suitable index value | ||
for(int i=0;i<n;i++) | ||
{ | ||
if(arr[i]==1) | ||
{ | ||
temp[1]++; | ||
} | ||
else if(arr[i]==0) | ||
{ | ||
temp[0]++; | ||
} | ||
else | ||
{ | ||
temp[2]++; | ||
} | ||
} | ||
int i=0; | ||
while(arr[0]>0&&i<n) | ||
{ | ||
arr[i]=0; | ||
arr[0]--; | ||
i++; | ||
} | ||
|
||
while(arr[1]>0&&i<n) | ||
{ | ||
arr[i]=1; | ||
arr[1]--; | ||
i++; | ||
} | ||
|
||
while(arr[2]>0&&i<n) | ||
{ | ||
arr[i]=2; | ||
arr[2]--; | ||
i++; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
int main() | ||
{ | ||
return 0; | ||
} |