@harsha : yes, the problem is if u r finding only min and max value, it
might happen that u sell the stock before buying. Ex-  int a [ ] = { 5, 10,
4, 6, 7 }; the min value is 4 and max is 10 and 10 comes before 4, means u
sell the stock before buying.
and i think the sol given by mukul does the same mistake.we need to keep
track this case also whether the day(array index) i m buying is not more
than the day(array index) we are selling the stock.

*correct me if  m wrong*.....

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