Nikhil,
Not sure whether I understood the problem properly or not, but If we know
the range of the element's why can't we do this?
for (i=min_r;i<=max_r;i++) temp^-i;
and then xor temp with array elements. If it is not what you are looking for
then please provide some sample input and corresponding o/p.


On Tue, Jun 21, 2011 at 11:55 PM, oppilas . <jatka.oppimi...@gmail.com>wrote:

> @Sanket,
> This is one of the possible solution but it does not take into account.
>
> On 6/21/11, sanket dhopeshwarkar <sanket.dhopeshwar...@gmail.com> 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
> > <nitishgarg1...@gmail.com>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 algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> 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 algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to