Product Array Except Self
Lesson 2 of 3 in Coddy's Interview Coding Challenges - Pack IX course.
Challenge
MediumWrite a function named productExceptSelf that, given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
For example,
Input: [1,2,3,4]
Output: [24,12,8,6]
Constraints:
- It's guaranteed that the product of the elements of any prefix or suffix of the array (including the whole array) fits in a 32-bit integer.
- Solve it without using division and in O(n).
Try it yourself
int* productExceptSelf(int* nums, int numsSize, int* returnSize) {
// Write code here
}