• + 4 comments

    So, for people who are stuck:

    This problem is very confusingly formulated. What it wants from you is, given a string, find all substrings that represent powers of 2.

    There are powers up to 800, that's a 800-bit integer, you ain't going to find one in any language. Hint: use strings.

    Then, you're going to need to find lots of substrings in a string. Others mentioned Aho-Corasick. I managed to do it just with tries. Aho-Corasick is essentially tries plus some optimization. So same thing, but simpler.