As the product of elements can be very large you need to return the answer in mod (10^9+7).
Try to do this without using the division operator ‘/’, in constant space. The output array does not count as extra space for the purpose of space complexity analysis.
The first line of the input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains a single positive integer ‘N’ denoting the number of the elements present in the array.
The second line of each test case contains ‘N’ space-separated integers denoting the elements of the array.
The only line of output of each test case should contain ‘N’ space-separated integers where ith integer denotes the product of all the elements in the array except itself.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10^2
2 <= N<= 10^4
1 <= A[i] <= 10^9
Where ‘T’ is the number of test cases, ‘N’ is the size of the array, ‘A[i]’ is the size of the array elements.
Time Limit: 1 sec
Longest Subarray With Zero Sum
Merge Two Sorted Arrays Without Extra Space
Merge Two Sorted Arrays Without Extra Space
Ninja And The Strictly Increasing Array
Negative To The End
Find Duplicate in Array