Skip to content

Files

Latest commit

 

History

History
15 lines (10 loc) · 328 Bytes

README.md

File metadata and controls

15 lines (10 loc) · 328 Bytes

Contiguous Subarray with Maximum Sum

This problem was asked by Twitter.

Description

You are given an array of integers. Find the maximum sum of all possible contiguous subarrays of the array.

Your solution should run in linear time.

Example

Input: [34, -50, 42, 14, -5, 86]
Output: 137 ([42, 14, -5, 86])