Sorting can be used i.e. O(nlogn).
Since O(1) space constraint is there, so hashing can't be used.

*Regards

Sanju

Happy to Help :)*



On Fri, Aug 19, 2011 at 4:36 AM, monty 1987 <[email protected]> wrote:

> But let us think in more general case let us say that numbers are
>
> 1 4 77 88 90 88
>
>
> Then How to do it???
>
>
> On Fri, Aug 19, 2011 at 5:01 PM, Sanjay Rajpal 
> <[email protected]>wrote:
>
>> Yes this is the restriction and in assumption I have cleared it .
>>
>>
>> *Regards
>>
>> Sanju
>>
>> Happy to Help :)*
>>
>>
>>
>> On Fri, Aug 19, 2011 at 3:33 AM, monty 1987 <[email protected]> wrote:
>>
>>> @Sanju
>>> I think there exists a restriction in your approach that all numbers
>>> between 1and n has to be present in the array.
>>>
>>> Thanks
>>> Soumitra
>>>
>>>  On Fri, Aug 19, 2011 at 9:53 AM, Sanjay Rajpal <
>>> [email protected]> wrote:
>>>
>>>> In the first loop, numbers are the numbers in the given array
>>>> but in the second loop, numbers are just natural numbers.
>>>>
>>>> I forgot to mention as people may get confused.
>>>>
>>>>
>>>>
>>>> *Regards
>>>>
>>>> Sanju
>>>>
>>>> Happy to Help :)*
>>>>
>>>>
>>>>
>>>>  --
>>>> 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.
>>>
>>
>>  --
>> 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.
>

-- 
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.

Reply via email to