CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsArrays

Product of Array Except Self

Medium
LeetCode
13/14
MediumArraysLeetCode #238

Product Except Self

No division. Prefix products from left, suffix from right.

Examples

Example 1

Input

4
1 2 3 4

Output

24 12 8 6
Example 2

Input

2
-1 1

Output

1 -1

Stuck? Take a nudge

C++17Autosaves