← ~/문제
P2001

Maximum Subarray

Medium
// 문제 설명
Given an array of n integers, find the contiguous subarray (containing at least one number) with the largest sum and output that sum.
// 입력
The first line contains an integer n (1 <= n <= 10^5). The second line contains n integers a_i (-10^4 <= a_i <= 10^4).
// 출력
A single integer: the maximum subarray sum.
// 힌트
Kadanes algorithm runs in O(n).
// 예제
입력 예제
9
-2 1 -3 4 -1 2 1 -5 4
출력 예제
6
// 문제 정보
난이도Medium
정답률50%
시간 제한1000 ms
메모리 제한65536 KB
정답5