# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param array int整型一维数组 
# @return int整型一维数组
#
class Solution:
    def FindGreatestSumOfSubArray(self , array: List[int]) -> List[int]:
        if len(array) == 1:
            return array
        leftlist = [0]
        dplist = [array[0]]
        left = 0
        for ind, val in enumerate(array):
            if ind == 0:
                continue
            if dplist[-1] < 0:
                dplist.append(val)
                left = ind
            elif dplist[-1] >= 0:
                dplist.append(val + dplist[-1])
            leftlist.append(left)

        maxlen = dplist[0]
        for i in range(1, len(dplist)):
            if dplist[i] >= maxlen:
                maxlen = dplist[i]
                resr = i
        resl = leftlist[resr]
        return array[resl:resr + 1]