[algogeeks] missing 2 nums in an array

2010-10-11 Thread Asquare
Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers. I know of a solution using another array to store frequency of each number.. But this holds for than 2 nums also.. So Is there any other solution

Re: [algogeeks] missing 2 nums in an array

2010-10-11 Thread bharath kannan
sum of n elements from 1=n(n+1)/2 product from 1 to n=n! calculate dis.. sum=calculated sum-orig sum prod=calculated prod-orig prod with dis form quadratic eq and solve... hope this works... On Tue, Oct 12, 2010 at 12:29 AM, Asquare anshika.sp...@gmail.com wrote: Given an array of size n. It