Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public int solution(int[] A) {
- int N = A.length;
- int max_ending = Integer.MIN_VALUE + 1000000;
- int max_slice = Integer.MIN_VALUE + 1000000;
- for (int i = 0; i < N; ++i) {
- max_ending = Math.max(A[i], max_ending + A[i]);
- max_slice = Math.max(max_slice, max_ending);
- }
- return max_slice;
- }
- }
Add Comment
Please, Sign In to add comment