From: Robert Dober Date: 2010-04-24T17:16:05+09:00 Subject: Re: Best way to write this method? On Sat, Apr 24, 2010 at 2:08 AM, steve ross wrote: > The algorithm I proposed for overlaps? is (by my count) at worst O(2). This one looks like at least O(n*m). Maybe I'm wrong about that. In any case, a good puzzle. Ah indeed that was the point I did not understand, it did not seem to work for all cases. The arrays contain ranges which are not contiguous. OP's algorithm does not work either, but you correctly translated it into an O(1). [ O(2) is a funny way to say it BTW, but I got the picture ;). ] Cheers R. -- The best way to predict the future is to invent it. -- Alan Kay