乘积最大子序列
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;
}
};