array index starting from 0 or 1?
in the for loop i <=length isn't it?
If no please explain
On 9/19/10, Ashish Goel wrote:
> this is google question
>
> take arrays before[] and after
>
> before[0]=1
> after[length-1]=1;
>
> for (int i=1; i {
> before[i]=a[i]*before[i-1];
> after[length-1-i]=a[
Handling ' 0 's
Case1: array containing single zero.
Caae 2: array containing multiple zeros.
int numberofZeros =0, index =0 ;
before[0]=1
after[length-1]=1;
for (int i=1; i1)
{
a[i]=0;
}
else
{
a[i] = before[i] * after[i];
}
}
Thanks,
NagRaaj.
On Sun, Sep 19, 20
this is google question
take arrays before[] and after
before[0]=1
after[length-1]=1;
for (int i=1; i 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 mess
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 algoge...