标签:logs maximum ++ div rod mat product [] highlight
class Solution { public int maxProduct(int[] nums) { int res=nums[0]; for(int i=1, imax=res,imin=res;i<nums.length;i++) { int cmax=Math.max(nums[i]*imax,nums[i]*imin); int cmin=Math.min(nums[i]*imax,nums[i]*imin); imax=Math.max(nums[i],cmax); imin=Math.min(nums[i],cmin); res=Math.max(res, imax); } return res; } }
标签:logs maximum ++ div rod mat product [] highlight
原文地址:http://www.cnblogs.com/asuran/p/7684888.html