I guess before[index] should contain product of the numbers before index and
after[index] should contain all the product after the index but @Ashish algo
isn't that before[index] contains product that includes the number at the
index position also. Please clarify me...

On Sun, Sep 19, 2010 at 9:27 PM, Minotauraus <[email protected]> wrote:

> It's been discussed here before.
> Start by multiplying from either sides of the array and stop when both
> pointers reach the opposite side.
> takes O(n) time and does not involve division so won't crap out for
> cases where some of the elements are 0.
>
> I was asked this for my Google phone screen I wish I knew this^ back
> then.
>
>
> On Sep 19, 7:48 am, bittu <[email protected]> wrote:
> > Given an array of numbers, replace each number with the product of
> > all the numbers in the array except the number itself *without* using
> > division.
>
> --
> 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