leetcode.jp 博客
本网站所有文字及图片内容均来自网络,每周定时更新,仅供个人学习与研究,请勿用于商业用途。谢谢合作。

53. Maximum Subarray

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

Example:

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

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.

Difficulty:

Easy

Lock:

Normal

Company:

Adobe Alibaba Amazon Apple Asana Atlassian Bloomberg ByteDance Capital One Cisco Citadel eBay Evernote Expedia Facebook Goldman Sachs Google Intel JPMorgan LinkedIn Microsoft Morgan Stanley Nvidia Oracle Palantir Technologies Paypal Salesforce SAP Two Sigma Uber Walmart Labs Wayfair Yahoo Zillow

Solution(Chinese):

LEETCODE 53. Maximum Subarray 解题思路分析