kadaneSAlgorithm()Imagine a business running month by month. If accumulated debt wipes you out, you declare bankruptcy on that project and start a fresh venture with clean books. You remember your highest peak profit ever achieved.
currentSum = -2. Drops below zero! Reset currentSum to 0.
### The Mission Imagine a rollercoaster ride with steep climbs (positive numbers) and sharp drops (negative numbers) along an array: `[-2, 1, -3, 4, -1, 2, 1, -5, 4]`. Your mission is to find the **contiguous track segment** that gives the maximum cumulative elevation gain (maximum sum). If a segment drops your cumulative altitude below zero, you immediately cut your losses, reset to zero, and start climbing fresh!