Kadane's algorithm
medium 16 minFind the contiguous subarray with the largest sum in one pass.
Where it shows up
The same pattern appears across everyday software.
Best trading window
Turn a price series into daily changes and the most profitable single buy-then-sell window is a maximum subarray. The same pass finds the worst drawdown if you run it with min.
Signal and image processing
Finding the stretch of a noisy signal with the highest total energy, or the brightest rectangle in an image (2D Kadane over column pairs), is the maximum subarray problem. Jon Bentley's Programming Pearls tells its origin in exactly this kind of pattern analysis.
Genomics: high-scoring segments
Score each base or amino acid (positive for a property you want, negative otherwise) and the most significant segment of a sequence is the best-scoring contiguous run, the core of tools that look for hydrophobic regions or GC-rich islands.
Product analytics and monitoring
Which run of days had the best net sign-ups, or the longest-hurting stretch of error budget? Subtract a baseline from each day and Kadane finds the strongest contiguous period in one pass over the data.
Games and sports streaks
A player's best run of plus-minus, a team's hottest stretch of point differential, or the best level segment in a game score log: any best streak where bad moments can be absorbed by good ones.