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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">