@theexceptioncat I recognize I do use space: but it’s a single pass … and O(n) on run time is pretty decent – better than O(NlogN), for sure O(N) is *really* O(½N), on average – but you round to O(N) if the data’s sorted, you can get O(log2(N)) :: binary search + comparing ±1 element



from Twitter https://twitter.com/warrenmyers

May 22, 2020 at 01:28PM
via IFTTT