how you do that in O(n)...
can you explain ???

On Mon, Jul 12, 2010 at 11:37 PM, amit <amitjaspal...@gmail.com> wrote:

> Stock prices are given to you at various time intervals. p1, p2,
> p3,... you are allowed to buy and sell only once each. So write a
> program to find the index where you would buy and where you would sell
> to maximize profit
>
> Correct me if i am wrong -->
>
> I think we can solve it in O(n) we simple have to find max(A[j]-A[i])
> with j>i.
> This is already discussed or am i missing something??
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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