adajahpickens6870 adajahpickens6870
  • 11-05-2022
  • Computers and Technology
contestada

Write a function solution that given an array a of n integers (between -100 and 100), returns the sign (-1,0,1) of product of all the numbers in the array multiplied

Respuesta :

YulTheNinja YulTheNinja
  • 17-05-2022

left[0]=a[0];

for(int i=1;i<=n-1;i++)

   left[i]=(left[i-1]*a[i])%M;

right[n-1]=a[n-1];

for(int i=n-2;i>=0;i--)

   right[i]=(right[i-1]*a[i])%M;

for query q

   if(q==0)

       return right[1]%M;

   if(q==n-1)

       return left[n-2]%M;

   return (left[q-1]*right[q+1])%M;

Answer Link

Otras preguntas

I just need the equation on how to do it. I'm so lost :'( help please!!!!!!
Hey, need some help reverent A. respectful B. respect C. reply D. to spoil
which of the following expressions does not equal: the sixth root of 81x^4y^8 a. (3xy^2)^2/3 b. (3x)^2/3y^4/3 c. (3x^2y^4)^1/3 d. cube root of 9x^2y^4
what does como eres tu mean in spanish?
Two diverging light rays, originating from the same point, have an angle of 5° between them. After the rays reflect from a plane mirror, what is the angle betwe
Consider two linear transformations y = T(x) and z = L(y), where T goes from R^m to R^p and L goes from R^p to R^n. Is the transformationz = L(T(x)) linear as w
Write a complete reaction of succinic acid and acetic anhydride
List all integers between -0.6 and 4.17 THANK U
which foods earthworms can digest?
wats the 60% off a prize that is $20.00