func FindGreatestSumOfSubArray(array []int) int{ if len(array) == 0 { return 0 } dp := make([]int, len(array)) dp[0] = array[0] maxNum := math.MinInt64 for i:=1; i<len(array); i++{ dp[i] = max(array[i], array[i]+dp[i-1]) if dp[i] > maxNum { maxNum = dp[i] } } return maxNum } func max(a, b int)int{ if a>b {return a} return b }