← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Given an integer array nums, return an array output where output[i] is the product of all the elements of nums except nums[i]. Each product is guaranteed to fit in a 32-bit integer.
Follow-up: Could you solve it in O(n) time without using the division operation?
n is the length of the input array nums.0 ≤ n ≤ 10^41 as it is the identity for multiplication.Example 1:
nums = [1,2,3,4][24,12,8,6]Example 2:
nums = [0][0]Example 3:
nums = [0,2][0,0]This problem can be solved using an O(n) time complexity algorithm by leveraging the properties of multiplication and avoiding division.