Non-Leetcode Questions: Product of Array
Given an array of numbers,nums
, return an array of numbers products
, where products[i]
is the product of all nums[j], j != i
.Input : [1, 2, 3, 4, 5] Output: [(2*3*4*5), (1*3*4*5), (1*2*4*5), (1*2*3*5), (1*2*3*4)] = [120, 60, 40, 30, 24]
You must do this in O(N)
without using division.Read full article from Non-Leetcode Questions: Product of Array
No comments:
Post a Comment