I have learnt how to find the maximum sum subsection using Kadane’s algorithm. However, in most of the questions in competitive programming, we often have to modify the algorithm to suit our purpose. For example, how to find maximum sum subsection provided that we can drop at most k elements, etc. How should I learn to modify the algorithm. Thanka in advance!
Will you mind giving an example and provide other specifications? (Link would be better) Array contains all positive or negative elements? You need not drop any if array has only positive.