121. Best Time to Buy and Sell Stock
来源:互联网 发布:iphone闪存检测软件 编辑:程序博客网 时间:2024/06/03 12:50
class Solution {public:int maxProfit(vector<int>& prices) {int len = prices.size();if (len == 0){return 0;}int minpos = 0;int maxn = 0 ;int j = 0;for (int i = 0; i < len; i++){if (prices[minpos] > prices[i]){minpos = i;}if (maxn < prices[i] - prices[minpos]){maxn = prices[i] - prices[minpos];}}return maxn;}};
阅读全文
0 0
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time To Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock
- 服务器的瞬时 Diffie-Hellman 公共密钥过
- Spring对CXF的整合
- MySQL ProxySQL读写分离实践
- 基于Eclipse的Android开发环境搭建
- 设计模式-工厂模式
- 121. Best Time to Buy and Sell Stock
- nodejs adm-zip 解压文件 中文文件名乱码
- JAVA基础面试题
- 在Linux虚拟机上安装QT
- Hadoop 学习笔记十 常见问题汇总
- 进程管理supervisor的简单说明
- 场景解析--Scene Parsing through ADE20K Dataset
- html子元素不继承父元素(opacity)的解决方法
- win7驱动预安装分享【xp/win8/win10的可以参考】