The TransCompilator

Solved LeetCode program · 207 of 1,000

#0238 · Product of Array Except Self

Medium Array chunk-05.md

Original English source

Keep a shared numbers holding 1, 2, 3, and 4. Keep a shared last of 3. Keep a shared product of 0.
To multiply from target (a whole number). Set product to 1.
For every other from 0 to last.
If other is not target, set product to product times item other of numbers.

The answer is an empty list of whole numbers.
For every slot from 0 to 3.
Place 0 into answer.

For every spot from 0 to last.
Multiply from spot. Set item spot of answer to product.

For each value in answer, show value.

Open in Playground Browse all 1,000 problems

Expected stdout

24
12
8
6