for example

1 2 3 4 5 6 7 8 9 9

So there are 10 number with all the 9 unique numbers.

So find the sum of 9 numbers 9*(9+1)/2 = 45

Find the sum of the given array 54

Subtract 54 -45 you will get the answer.

but this work if all the number from 1 to n-1 are there in the array.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to