top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Find the missing element from the given 2 arrays, second array is duplicate?

–1 vote
551 views

Say you are given two arrays where second array is duplicate with one missing element. What should be the best possible way to find that missing element -
array1: [1,2,3,4,5,6,7]
array2: [1,3,4,5,6,7]

Missing Element: 2

posted May 9, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Here is a quick tip to solve this programming question: put the elements of the second array in the Hashtable and for every element of the first array, check whether it’s present in the hash or not, O/P all those elements from the first array that are not present in the hash table

answer May 12, 2016 by Hasan Raza
Similar Questions
0 votes

Given an array of integers, rearrange the array in such a way that the first element is first maximum and second element is first minimum.

+2 votes

Say you are given an array which has all duplicate members except one, which out this non-duplicate member.

0 votes

Given an array of sorted integers and find the closest value to the given number. Array may contain duplicate values and negative numbers.

Example : Array : 2,5,6,7,8,8,9
Target number : 5
Output : 5

Target number : 11
Output : 9

Target Number : 4
Output : 5

0 votes

Given an unsorted array which has a number in the majority (a number appears more than 50% in the array), how to find that number?

...