Problem 07 of 75
Product of Array Except Self
The problem
Given an integer array nums, return an array answer such that answer[i] is the product of all the elements of nums except nums[i]. You must not use division, and the algorithm must run in O(n).
[1,2,3,4] → [24,12,8,6]
Your solution runs against 2 unit tests, including edge and large-value cases.
Loading...
Test console · 2 unit tests
Submit your code to run it against all 2 unit tests. Results appear here.
JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.
Hint
Reference solution
Video explanation
GO DEEPER
The full interview treatment: the conversation, why the approach works, and step-by-step visuals.