博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
乘积最大子序列
阅读量:4656 次
发布时间:2019-06-09

本文共 466 字,大约阅读时间需要 1 分钟。

public class Solution {

/
@param nums: An array of integers
* @return: An integer
/
public int maxProduct(int[] nums) {
// write your code here
int max = nums[0];
int index = 1;
while(index <= nums.length){
for(int i = 0;i< = nums.length-index;i++){
int product = 1;
for(int j=0;j<index;j++){
product
= nums[i+j];
}

if(product > max)                 max = product;        }        index ++;    }    return max;}

};

转载于:https://www.cnblogs.com/yiwenhao/p/7407558.html

你可能感兴趣的文章
IDC美股行情处理
查看>>
Umbraco遇到的问题解决
查看>>
句子逆序,近义词维护,数字颠倒,蛇形矩阵
查看>>
hadoop常见问题
查看>>
效率极低人群之七大习惯
查看>>
《转》笑死古人了,看看流行语用古文怎么说?
查看>>
HTML特殊字符编码对照表
查看>>
删除字符串中间的空格
查看>>
linux学习-DAY3-上线BBS项目、ansible的使用
查看>>
P4001 [BJOI2006]狼抓兔子
查看>>
cuda科普像素坐标和线性偏移
查看>>
算法阶段二
查看>>
珍惜现有的生活,珍惜关爱自己的人(摘)
查看>>
Oracle Sql Developer 连接 SqlServer
查看>>
h5视频和音频 -2018/04/16
查看>>
Spark记录-Scala异常处理与文件I/O
查看>>
POJ 3253 Fence Repair
查看>>
zbb20170606 oracle 查看被锁定的表
查看>>
4-22 学习心得
查看>>
define,const, enum,inline区别用法
查看>>