In array of n numbers one numer repeating, detect it in one pass

Repeated Number = Sigma(n) – Sigma(n-1)

Q. The integers from 1 to n are stored in an array in a random fashion. but one integer is missing. Write a program to find the missing integer.

Follow the same technique

Leave a Reply

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