最大子数组和
2025-4-20
| 2025-4-20
Words 338Read Time 1 min
type
status
date
slug
summary
tags
category
icon
password

题目

给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
子数组 是数组中的一个连续部分。
示例 1:
示例 2:
示例 3:

思路:贪心算法

notion image
image-20220108150206317

代码:

结果:

notion image
image-20220108154246718
最大连续1的个数最大交换
Loading...