• + 0 comments

    Interesting. For anyone who doesn't understand, let's assume that we know a maximum is at position i in the list. We know that the intervals that don't include i will not contribute to the calculation of i. If we add a spike at the start of a interval, and subtract the spike from right after the interval, then when you add the two spikes together, you will get zero, which is what we want to happen if i is not in that interval. As intervals overlap, there will be multiple positive spikes followed by multiple negative spikes. When you add the positive spikes together, you find a local maximum, and then when you add the negative spikes, you descend from that maximum. The global maximum can thus be found by traveling along the spikes and comparing local maximums. It's almost like you're adding the impulse response of each interval. This solution is not obvious.