Leetcode | 52. Maximum Subarray | Java | C#

Published: 10 October 2020
on channel: CodeOnline
623
4

Leetcode | 52. Maximum Subarray | Java | C#


Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

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.



Example 1:

Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.


On this page of the site you can watch the video online Leetcode | 52. Maximum Subarray | Java | C# with a duration of hours minute second in good quality, which was uploaded by the user CodeOnline 10 October 2020, share the link with friends and acquaintances, this video has already been watched 623 times on youtube and it was liked by 4 viewers. Enjoy your viewing!