← problems
#238

Product of Array Except Self

MediumArrays & Hashing

Given an integer array nums, return an array answer such that answer[i] is the product of all elements of nums except nums[i].

Solve it without using division and in O(n).

Example

nums = [1, 2, 3, 4]  => [24, 12, 8, 6]
Implement
function ProductExceptSelf(nums: int[]) -> int[]

Found a bug? Or annoyed about something in the language? Tell us.

loading editor…