49. Product of Others
Medium
Given an array of integers, return an array where each position contains the product of all values except the value at that position. Do not use division.
Example 1
Input: nums = [2,3,4,5]
Output: [60,40,30,24]
Example 2
Input: nums = [-1,2,0,4]
Output: [0,0,-8,0]
Constraints
- 2 <= nums.length <= 10000
- -30 <= nums[i] <= 30
Arrays
Saved in this browser
Caso 1
nums =
[2,3,4,5]
Expected =
[60,40,30,24]
Caso 2
nums =
[-1,2,0,4]
Expected =
[0,0,-8,0]
Run checks these 2 cases. Submit runs all 6, including hidden ones.