@nicks..if i am getting ur algo right than if input array is 0, -10, -12, 19, 20, -1, -2 than array b will be 0, 0, 0, 19, 380, -1, 2 so ans ll b 380 but ans should b 45600 On Wed, Jul 13, 2011 at 10:18 AM, oppilas . <jatka.oppimi...@gmail.com>wrote:
> The O(N) solution which I can think of. > We need to divide the array in subarray's with division point being 0. > Now, in those sub arrays, there are two cases: > First- even number of -ve numbers, then max product of that subarray will > be product of all elements. > If it contains odd number, then take the product of sub array and divide it > with min( MOD(product from start to first- ve number),( last -ve number till > end)) > > > On Wed, Jul 13, 2011 at 10:03 AM, shilpa gupta > <shilpagupta...@gmail.com>wrote: > >> array contain negative numbers also including natural numbers correct >> it... >> >> On Wed, Jul 13, 2011 at 9:43 AM, shilpa gupta >> <shilpagupta...@gmail.com>wrote: >> >>> given an array of natural numbers (+ve, 0, -ve) find the maximum >>> product of continuous elements.efficient( O(nlogn) or better)solution >>> is needed. >>> thanks >>> >>> -- >>> 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. >>> >>> >> >> >> -- >> shilpa gupta >> b tech 2nd year >> computer science and engineering >> mnnit allahabad >> >> >> -- >> 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. > -- shilpa gupta b tech 2nd year computer science and engineering mnnit allahabad -- 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.