I have an array Array = {}, size of array is n
My constraints are like this:
n <= 100000 and Arrayi <=100
I have to find the products of all the elements in the array, I will be given a mod value with which I have to mod the product. The mod will value changes all the time and this mod value is always less than or equal to n.
My problem is when I chose, a global mod value say R = 1000000000 (which is far bigger than mod constraint) and whenever my product exceeds this value, I mod the result.
But I dont know why the result Im obtaining is zero.
My question is how do I chose R in such situations?