Search
⌘K

Leetcode 1711. Count Good Meals

Count the number of index pairs (i<j) in an array whose values sum to a power of two, returning the result modulo 1e9+7. The challenge is to do this efficiently for up to 1e5 elements and values up to 2^20 by checking a small set of power-of-two targets (≈21) using frequency counting or hashing rather than O(n^2).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.