Product Except Self
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

30:00

Product Except Self
medium
Topics
Companies

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

Example 1:
Input: [1,2,3,4]
Output: [24,12,8,6]
Constraints:
  • 2nums.length1052 \leq \text{nums.length} \leq 10^5

  • 30nums[i]30-30 \leq \text{nums}[i] \leq 30

  • The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.

  • Solution must run in O(n)O(n) time and without using the division operation.

Input
arr =[1,2,3,4]
Input Array (nums)10213243
Current Phase:
PREFIX
Prefix Product:
1
Postfix Product:
1
Result Array00010203
Variables
No variables to display
DepthFunction Call
1productExceptSelf(nums=[4])
0/27