@Sanket, This is one of the possible solution but it does not take into account.
On 6/21/11, sanket dhopeshwarkar <[email protected]> wrote: > 1. find the min , max, and sum of all elements in array(say z) ----- o(n) > 2. find x= sum(1..min) and y = sum(1..max) > 3. ans = y-(x-min) -z > if(ans ==0) return (min-1) or (max +1); > else return ans; > > On Tue, Jun 21, 2011 at 7:37 PM, Nitish Garg > <[email protected]>wrote: > >> ^^ The first solution could have done had it not for that much extra >> space. >> ^ I think the question can be solved in O(n) without using extra space. >> Need to scratch the grey cells! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/7KbVmPz3HGsJ. >> >> 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?hl=en. >> > > -- > 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?hl=en. > > -- 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?hl=en.
