Largest run sum
A run is one or more consecutive values of nums. Return the largest sum that any run can have.
nums has 1 to 10,000 integers between −10,000 and 10,000. Aim for one pass and O(1) extra space.
Besides the tests, one large input (6,000 values) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
largest_run_sum([2,-3,4,-1,2,-5,3])→5largest_run_sum([6,-2,7])→11largest_run_sum([5,-9,5])→5