O(nlogn) Algorithm – Find three evenly spaced ones within binary string
Finally! Following up leads in sdcvvc’s answer, we have it: the O(n log n) algorithm for the problem! It is simple too, after you understand it. Those who guessed FFT were right. The problem: we are given a binary string S of length n, and we want to find three evenly spaced 1s in it. … Read more