@jalaj
Your approach will not work, what I perceived from your solution, as in
question the maximum difference S is defined as:-
S = a[i] - a[j] where* "i>j"
*Perhaps you forgot that the 'order' of the max and min also matters :)


Anurag Sharma


On Mon, Jun 21, 2010 at 10:34 PM, jalaj jaiswal
<[email protected]>wrote:

> traverse the array ...take two variables min and max ... and update them
> ...while traversing.....
> finally min will contain the most negative value,,, and max will contain
> the most positive vale... do max-min.. that will be S
>
> On Mon, Jun 21, 2010 at 5:38 PM, amit <[email protected]> wrote:
>
>> There is an integer array consisting positive and negative integers.
>> Find maximum positive difference S defined as:
>>
>> S = a[i] - a[j] where i>j
>> and
>> S > 0
>>
>> --
>> 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]<algogeeks%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> With Regards,
> Jalaj Jaiswal
> +919026283397
> B.TECH IT
> IIIT ALLAHABAD
>
> --
> 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]<algogeeks%[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