Solution
Maximum Subarray
Be careful of the problem description
If more than one segment is maximally nice, choose the one with the longest cycle ride (largest j − i).
To break ties in longest maximal segments, choose the segment that begins with the earliest stop (lowest i).
Carefully set your condition
(sum > mx || (sum == mx && i+1-start > final_end - final_start)
code
Originally published at geniustanley.github.io on December 25, 2017.