给定一个整数数组 ,找出一个序列中乘积最大的连续子序列的乘积(该序列至少包含一个数)。
示例1
输入
[2,3,-4,2]
输出
6
加载中...
import java.util.*; public class Solution { /** * * @param nums int整型一维数组 * @return int整型 */ public int maxProduct (int[] nums) { // write code here } }
class Solution { public: /** * * @param nums int整型一维数组 * @param numsLen int nums数组长度 * @return int整型 */ int maxProduct(int* nums, int numsLen) { // write code here } };
# # # @param nums int整型一维数组 # @return int整型 # class Solution: def maxProduct(self , nums ): # write code here
/** * * @param nums int整型一维数组 * @return int整型 */ function maxProduct( nums ) { // write code here } module.exports = { maxProduct : maxProduct };
# # # @param nums int整型一维数组 # @return int整型 # class Solution: def maxProduct(self , nums ): # write code here
[2,3,-4,2]
6