Product of All Other Elements

Asked at Apple · Coding Questions · Difficulty: Medium

Given an integer array `nums`, build and return a new array `output` of the same length where `output[i]` is the product of every element of `nums` except `nums[i]`. Zeros may appear in the input, and the array may contain a single element.

Loading the problem…