Oracle Interview Question: Find 2 or more missing number... | Glassdoor.co.in

Interview Question

Senior Software Engineer Interview Bengaluru

Find 2 or more missing numbers in a set of 100 natural

  numbers
Answer

Interview Answer

6 Answers

This post has been removed.
Please see our Community Guidelines or Terms of Service for more information.

This post has been removed.
Please see our Community Guidelines or Terms of Service for more information.

This post has been removed.
Please see our Community Guidelines or Terms of Service for more information.

0

Create code that sorts the numbers and then write an algoirthm to check to see if the increments between each number is equal to 1.

If not, then add 1 to the previous number to get the missing number.

Birdie num num.

Bang on on 16-Feb-2011
0

Since its 100 natural numbers the sorting can be done using an array/counting sort in constant time O(100).

Now iterate and find the missing elements.

Arun on 05-Mar-2011
0

Sort the array..create two subarrays with =50 and check count of each array..the one which is sorted..pass it to method which divides it to 1/2 again..

Sudip on 03-Jul-2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.