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
how can u do connectivity in c++ language? plz send me connectivity code in c++ ?
How does an stl file work?
please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html
In what scenario does the Logical file and Physical file being used?
What is stl stack?
Is stl part of c++ standard?
What do stl stand for?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Is stl open source?
How stl is different from the c++ standard library?
To modify an, existing worksheet. What steps are involved for: 1. Inserting and deleting rows and columns. 2. Printing cell formulas 3Jld displayed values 3. Using the page setup command
Can we use stl in coding interviews?
How connect plc and pc through software
What is the stl, standard template library?
What is a list in c++ stl?