Comment Comment by veyron if K is fixed, as in the example from the article, this can be done in O(N) ... parent veyron 15 years ago