Skip to content

Commit

Permalink
Update 53. Maximum Subarray
Browse files Browse the repository at this point in the history
  • Loading branch information
dingjiachengcn authored Jun 2, 2023
1 parent b9a51a2 commit 4e5446a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions 53. Maximum Subarray
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
Given an integer array nums, find the
subarray
with the largest sum, and return its sum.

Given an integer array nums, find the subarray with the largest sum, and return its sum.


Example 1:

Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Expand All @@ -23,16 +19,14 @@ Explanation: The subarray [5,4,-1,7,8] has the largest sum 23.

Constraints:

1 <= nums.length <= 105
-104 <= nums[i] <= 104
1 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4


Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

题目:给定一个整数数组 nums,找到具有最大和的子数组,并返回其和。

示例 1:

输入:nums = [-2,1,-3,4,-1,2,1,-5,4]
输出:6
解释:子数组 [4,-1,2,1] 有最大的和 6。
Expand Down

0 comments on commit 4e5446a

Please sign in to comment.