if array a conatins 'n' elements and array b conatins 'n-1'
elements.array b has all element which are present in array
a but one element is missing in array b. find that
element.

Answer Posted / ajay c.

Take a temp variable of datatype of the array element.
Place a[0] in temp.

now for each element in array a compare with all elements
of array b. if any element is not found in array b, that is
the missing element.

what i guess though is that the interviewer may be trying
to look for a short-cut method to achieve the above. So, i
googled it and found a very nice answer:
http://stackoverflow.com/questions/1235033/java-comparing-
two-string-arrays-and-removing-elements-that-exist-in-both-
arrays

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to set file pointer to beginning c?

914


What is the difference between malloc() and calloc() function in c language?

829


Why main is used in c?

825


How do you use a pointer to a function?

858


Is c is a procedural language?

817


How can I get random integers in a certain range?

796


What are the advantages and disadvantages of a heap?

927


How to compare array with pointer in c?

843


What is the use of linkage in c language?

826


What is linear search?

912


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2530


Was 2000 a leap year?

832


How can I get back to the interactive keyboard if stdin is redirected?

888


What is the most efficient way to count the number of bits which are set in an integer?

831


What are reserved words with a programming language?

831