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 / ninad
public int check(int a[], int b[])
{
int x;
int[] c=new int[a.length];
for(int i=0; i<=c.length; i++)
{
c[i]=0;
}
for(int i=0; i<=a.length; i++)
{
for(int j=0; j<b.length; j++)
{
if(a[i]==b[j])
c[i]=1;
}
}
for(int i=0;i<=c.length;i++)
if(c[i]==0)
x=a[i];
return x;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a stl vector?
How is stl different from c++ standard library?
What do stl stand for?
how to making game in c++ ?
When did c++ add stl?
How does an stl file work?
How connect plc and pc through software
What two types of containers does the stl provide?
What are the different types of stl containers?
What are stl algorithms?
What is meant by stl in c++?
Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister
Define stl.
What is a standard template library (stl)? What are the various types of stl containers?
What is a list in c++ stl?