149
来源:互联网 发布:正规java培训班 编辑:程序博客网 时间:2024/06/05 17:09
5.22
public class Solution { /** * @param prices: Given an integer array * @return: Maximum profit */ public int maxProfit(int[] prices) { // write your code here int max = 0; int length = prices.length; if(length <= 1){ return 0; } for(int i = 0;i < length -1;i++){ for(int j = i+1;j < length;j++){ int tmp = prices[j] - prices[i]; if(tmp > max){ max = tmp; } //System.out.println(i +"," + j + ",tmp:" + tmp); } } return max; }}
阅读全文
0 0
- 149
- sgu 149
- ocp-149
- 149@365
- CDOJ 149
- Leetcode 149
- reactos操作系统实现(149)
- sgu 149 Computer Network
- CF 149 div2感想
- codeforces #149 div 2
- CF-div2--149
- 149_leetcode_Text Justification
- 第149天
- sgu 149解题记录
- 149 高敬命 霽峯
- 149,关闭键盘
- leetcode #149 in cpp
- Leetcode no. 149
- CodeForces 810A Straight <<A>> 【数学】【模拟】
- HDU3507(dp + 斜率优化dp)
- C++之内存的申请和释放
- 【Linux】ubuntu中怪异的vi编辑器
- (转)blackrock的阿拉丁系统与风险管理
- 149
- Android Studio2.3正式版带SDK安装教程
- C++:虚函数和纯虚函数的区别和用法
- EF Mapping Entity Framework Fluent API
- 2-vuejs2.0实战:仿豆瓣app项目,创建组件header,tabbar路由跳转
- 迭代法和埃特金加速法求根
- 文件操作
- UISegmentedControl 背景颜色 和 字体颜色
- javascript添加到收藏夹写法