238. Product of Array Except Self
来源:互联网 发布:北京域名百科 编辑:程序博客网 时间:2024/06/05 20:02
该位置的积=左边的积*右边的积
class Solution {public: vector<int> productExceptSelf(vector<int>& nums) { int n=nums.size(); int i; vector<int> output; int P=1; output.push_back(1); for(i=1;i<n;i++) { output.push_back(output[i-1]*nums[i-1]); } for(i=n-2;i>=0;i--) { P=P*nums[i+1]; output[i]=output[i]*P; } return output; }};
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
- 238. Product of Array Except Self LeetCode
- LeetCode 238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- [LeetCode]238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- 238. Product of Array Except Self
- LeetCode *** 238. Product of Array Except Self
- LeetCode 238. Product of Array Except Self
- Nginx安装
- Deep Learning 学习系列001 —— 神经网络基本概念
- Qt学习之九:深入对话框
- 验证码生成
- android调用系统摄像机
- 238. Product of Array Except Self
- jqGrid 各种参数 详解
- 67. Add Binary*
- 停止一个线程
- Android快速开发推荐10个框架Android 快速开发框架:afinal、ThinkAndroid、andBase、KJFrameForAndroid、SmartAndroid、
- android(2):按钮点击事件的四种写法(装载)
- Java面试题集(七)--Spring常见面试问题
- CCF计算机软件能力认证模拟试题
- Leetcode.174 Dungeon Game |算法解析——动态规划