ntree.aiProduct of Array Except Self
Product of Array Except Self
mediumsolvedattempted
Given an array of integers nums, return an array answer where answer[i] is the
product of every element of nums except nums[i].
Example 1:
Input: nums = [1, 2, 3, 4]
Output: [24, 12, 8, 6]
Explanation: 2*3*4, 1*3*4, 1*2*4, 1*2*3.
Constraints:
2 <= length of nums <= 10^5-30 <= nums[i] <= 30- product of all elements fits in a 32-bit integer
def productExceptSelf(nums: list[int]) -> list[int]: pass Press Visualise to step through your code.