Mid-levelMid (3–6 yrs)CodingPythonMetaAmazonApple
Product except self
Return an array answer where answer[i] equals the product of all elements except nums[i], without using division.
Answers use simple, clear English.
Time: O(n)Space: O(1) extra
Quick interview answer
Build prefix products left-to-right, then multiply by suffix products right-to-left in a second pass. O(n) time, O(1) extra space excluding output.
Detailed answer
Build prefix products left-to-right, then multiply by suffix products right-to-left in a second pass. O(n) time, O(1) extra space excluding output.
midsenior#array#prefix#blind75