I will try to give one solution for this vaguely... Correct me if Im wrong. But, the solution suffers overflow problem if implemented.
Assume that the number which got replaced is "x" and the number which replaced it is "y" obtain the sum of all the numbers, say Sum so, Sum - y + x = n(n+1) / 2 eq1 obtain the sum of the squares of all the numbers, say sqSum so, sqSum - sqr(y) + sqr(x) = n(n+1)(2n+1) / 6 eq2 Solving the above two equations will give the actual replaced number ; --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
