Skip to content

Commit

Permalink
Merge pull request #112 from Jagpreet153/day_21_medium_Jagpreet153
Browse files Browse the repository at this point in the history
feat: solved day 21 medium
  • Loading branch information
shiwangi-07 authored Apr 16, 2024
2 parents bd9a95d + bf6af99 commit 12ee9d7
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion Medium/Day 21/solution.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
// Write your code here.
// Write your code here.
// Code By Jagpreet153
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[200010],b[200010],c[200010];
set<int> ans;
int main(){
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++) cin>>b[i];
sort(b+1,b+n+1);
for(int i=1;i<=n;i++){
int x=a[i]^b[1],flg=1;
for(int j=1;j<=n;j++) c[j]=x^a[j];
sort(c+1,c+n+1);
for(int j=1;j<=n;j++) if(c[j]!=b[j]) flg=0;
if(flg) ans.insert(x);
}
cout<<ans.size()<<endl;
for(int x:ans) cout<<x<<endl;
return 0;
}

0 comments on commit 12ee9d7

Please sign in to comment.