Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .
Answer Posted / abhi
#include<iostream>
using namespace std;
#include<algorithm>
int main()
{
int n;
cin>>n;
int a[n],b[n-1];
int sum1=0,sum2=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
sum1+=a[i];
}
for(int i=0;i<n-1;i++)
{
cin>>b[i];
sum2+=b[i];
}
cout<<sum1-sum2<<endl;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How does an stl file work?
In what scenario does the Logical file and Physical file being used?
Define stl.
a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.
What is a list in c++ stl?
How do you convert stl to steps?
What is the stl, standard template library?
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
i wanted to know about questions about c,c++ , which is required for placements.... im a fresher
Who created stl?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
What are stl algorithms?
What are the symptoms of stl?
Is string part of stl?
What is a standard template library (stl)?