Biggest sum of a stretch
hardProblem solving40 XP
Return the largest sum of a non-empty run of neighbouring numbers in nums. Can you do it in one pass (look up Kadane's algorithm)?
Examples
- Input: nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]Output: 6
- Input: nums = [-3, -1, -2]Output: -1
Examples use JSON: true/false/null are True/False/None in Python.