LeetCode Golang Hot53-最大子数组和
https://leetcode-cn.com/problems/maximum-subarray/
贪心算法
package main
import "fmt"
func main() {
res := maxSubArray([]int{-3, -1, -5})
fmt.Println(res)
}
func maxSubArray(nums []int) int {
if len(nums) == 0 {
return 0
}
var max
原创
2022-03-15 23:49:06 ·
382 阅读 ·
0 评论