Find the Missing Number in array

You are given a list of n-1 numbers and these numbers are in the range of 1 to n. There are no duplicates in list. One of the number is missing in the list. Write a program to find the missing number.

Example:

Solution:

Output

 

Posted in java programs and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *