Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is basically the prefix sum technique in disguise: the sum over an interval is the difference between the prefix sums to the endpoints. The summation can be substituted with any group operation, in this case modulo-2 addition of 26-long vectors.

Many leetcode-type problems are amenable to O(n) speedups using this technique.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: