Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Dado un array de enteros (nums), encontrar el subarray contiguo (que tenga al menos un número) que tenga la máxima suma y retornar dicha suma.
Ejemplo:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explicación: [4,-1,2,1] tiene la máxima suma = 6.
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Dado un
arrayde enteros (nums), encontrar el subarray contiguo (que tenga al menos un número) que tenga la máxima suma y retornar dicha suma.Ejemplo: