656. Selfless Product of Array
0
Medium
You are given an integer array nums and
**Selfless Product** of an element `nums[i]` can be defined as product of all elements of the array except itself.
Print an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
***Note: The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer***.
Input Format
First Line contains an integer N (size of the array) .
Second Line contains an array.
Second Line contains an array.
Output Format
Print an array of selfless products.
Example
Input
4
1 2 3 4
Output
24 12 8 6
Constraints
1 <= N <= 105
-30 <= nums[i] <= 30
-30 <= nums[i] <= 30
Loading...
View Submissions
Console