Sum equal to sum
Vishal Yadav
Posted on January 22, 2022
Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[]={4,11,5,13};
int n=4;
unordered_set<int>mp;
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int sum=a[i]+a[j];
if(mp.find(sum)!=mp.end())
cout<<1;
mp.insert(sum);
}
}
cout<<0;
return 0;
}
π πͺ π
π©
Vishal Yadav
Posted on January 22, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.