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
How to set file pointer to beginning c?
What is the difference between malloc() and calloc() function in c language?
Why main is used in c?
How do you use a pointer to a function?
Is c is a procedural language?
How can I get random integers in a certain range?
What are the advantages and disadvantages of a heap?
How to compare array with pointer in c?
What is the use of linkage in c language?
What is linear search?
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.
Was 2000 a leap year?
How can I get back to the interactive keyboard if stdin is redirected?
What is the most efficient way to count the number of bits which are set in an integer?
What are reserved words with a programming language?