159: Product of array except self
Given an array of integers (length > 1), return an array where i-th element is equal to the product of all the elements except i-th number
Note: Solve
without divisionand inO(n)
Example 1
Input: [1, 2, 3]
Output: [6, 3, 2]
Example 2
Input: [1, 2, 3, 4, 5]
Output: [120, 60, 40, 30, 24]