leetcode 238 Product of Array Except Self
来源:互联网 发布:php o2o系统 编辑:程序博客网 时间:2024/06/03 18:35
题目:Given an array of n integers where n > 1, nums
, return an array output
such that output[i]
is equal to the product of all the elements of nums except nums[i]
.
求一个数组中除了某个元素本身的其他元素之积,,最终输出所有这样积的数组
要求:不能使用除法,时间复杂福为O(n)
思路:对于数组中的某一个元素,如果我们知道其前面所有数字的乘积,同时也知道后面所有的数乘积,那么二者相乘就是我们要的结果。
代码AC:
0 0
- leetcode 238: Product of Array Except Self
- LeetCode 238: Product of Array Except Self
- Leetcode #238 Product of Array Except Self
- Leetcode 238 Product of Array Except Self
- [leetcode 238]Product of Array Except Self
- LeetCode(238)Product of Array Except Self
- leetcode 238: Product of Array Except Self
- Leetcode #238 Product of Array Except Self
- [LeetCode 238] Product of Array Except Self
- leetcode 238:Product of Array Except Self
- Product of Array Except Self - LeetCode 238
- LeetCode 238 Product of Array Except Self
- 【LEETCODE】238-Product of Array Except Self
- LeetCode 238:Product of Array Except Self
- leetcode 238 Product of Array Except Self
- leetcode 238: Product of Array Except Self
- [LeetCode 238] Product of Array Except Self
- LeetCode[238]Product of Array Except Self
- 坑了我一个小时的脚本执行
- Spring 注解
- Android自定义view之- BitMap的绘制
- 数据结构之链表
- TreeSet类
- leetcode 238 Product of Array Except Self
- Http协议
- Azure Messaging-ServiceBus Messaging消息队列技术系列4-复杂对象消息是否需要支持序列化和消息持久化
- 进程优先队列
- Swap Nodes in Pairs
- 泛型
- Linux笔记
- Java系列(一)Annotation(注解)
- 流体布局与浮动元素