Skip to content

#238 - Product of Array Except Self

MediumArray / String
Open on LeetCode

Given an integer array nums, return an array answer where answer[i] equals the product of all elements of nums except nums[i]. You must solve it without using division and in O(n) time. The output array does not count as extra space.

InputOutput
nums = [1,2,3,4][24,12,8,6]
nums = [-1,1,0,-3,3][0,0,9,0,0]

Released under the MIT License.