Given an array, check if there exists 2 elements of the array such that their sum is equal to the sum of the remaining elements of the array.
Answers
Answered by
0
Answer:
..
Explanation:
n is number of members in array.
sum=half of sum of whole array
int ans=0;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if (array[i]+array[j]==sum)
ans=1;
}
}
now if and is 1 then yes,else no.
Similar questions