#C14528. Product Except Self
Product Except Self
Product Except Self
Given an array of integers \(nums\) of size \(n\), your task is to compute an output array \(output\) such that for every index \(i\),
\(output[i] = \prod_{\substack{j=0 \\ j\neq i}}^{n-1} nums[j]\).
You must solve this problem without using division. For example, if \(nums = [1, 2, 3, 4]\), the correct output is \([24, 12, 8, 6]\).
inputFormat
The input consists of two lines. The first line contains a single integer (n) representing the number of elements. The second line contains (n) space-separated integers which constitute the array (nums).
outputFormat
Output a single line with (n) space-separated integers, where the (i)-th integer is the product of all elements of the input array except the one at index (i).## sample
4
1 2 3 4
24 12 8 6
</p>