interview question

########################################
There are numbers from 1 to N in an array. out of these, one of the number gets duplicated and one is missing. The task is to find out the duplicate number. Conditions: you have to do it in O(n) time without using any auxiliary space (array, bit sets, maps etc..)

1 comment:

sathish.kulal said...

square the array and find the sum to get the solution