Best Time to Buy and Sell Stock
来源:互联网 发布:高效程序员的45个 编辑:程序博客网 时间:2024/05/16 07:52
public class Solution { public int maxProfit(int[] prices) { if(prices.length == 0) return 0; int low = prices[0]; int ans = 0; for(int i=1; i<prices.length; i++){ if(prices[i] < low) low = prices[i]; else if(prices[i] - low > ans) ans = prices[i] - low; } return ans; }}
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
- Android 如何动态设置View参数,LayoutParams.addRules详解,TypedValue.applyDimension的使用
- shell函数的定义,返回值和参数
- 接受前台数据
- 问题归纳(1) Avoid using "px" as units; use "dp" instead
- Split函数,正则表达式与空字符串
- Best Time to Buy and Sell Stock
- ubuntu系统的grub配置
- IOS学习 网络 SSZipArchive 解压缩文件
- 关于java中文件下载中文乱码的事
- 用Beyond Compare如何进行文本比较
- 图像优化
- android数据库sqlite基本操作。
- ArcGIS教程:为地理处理任务定义输出符号系统
- QLibrary加载so的注意事项