美文网首页
238. Product of Array Except Sel

238. Product of Array Except Sel

作者: 我是你的果果呀 | 来源:发表于2016-12-07 11:04 被阅读0次

Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].
Solve it without division and in O(n).
For example, given[1,2,3,4], return[24,12,8,6].

Follow up:
Could you solve it with constant space complexity? (Note: The output arraydoes notcount as extra space for the purpose of space complexity analysis.)

不能用除法, 那么采用这个数左边数的乘积 乘以右边数的乘积,即得到所要结果。

相关文章

网友评论

      本文标题:238. Product of Array Except Sel

      本文链接:https://www.haomeiwen.com/subject/vjydmttx.html