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

The coordinates of the vertices of △RST are R(−3, −1) , S(−1, −1) , and T(−4, −5) . The coordinates of the vertices of △R′S′T′ are R′(1, −2) , S′(1, 0) , and T
8 +7m = m +5m5 +2n = -1 +4n
Use the distributive property to solve 4 (2x + 9)
What prompted the Happy Medium to say, “it can be overcome,”?
Please help me figure this problem out I’m so lost!
PLEASE AWNSER QUICKLY !!!! What is the number in scientific notation? Drag the answer into the box to match the number. 409,200,000,000 ​​ ​ 4.092× 10 ^8 ​​
Suppose that shoe sizes of American women have a bell-shaped distribution with a mean of 8.47 and a standard deviation of 1.5 . Using the empirical rule, wha
What is Machiavelli’s advice to a leader who is confronted with doing the virtuous thing or the thing that best assures survival
As a student what can you contribute to society?
Plz help! ASAP! I will make u brainliest! plz show work. Thanks!