A Neat XOR Trick
Looking over the solutions mega-thread, it seems like not many people discovered this trick; when I posted about it, people found it to be noteworthy.
But twiddling tricks and popcnt are always fun.
“With this last trick, we're down to O(N) running time, with no dependence on the window size! I didn't do rigorous benchmarking, but one reply said that this trick sped up their code by almost 3x.”Posted on 2022-12-13T17:57:02+0000