
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Note that the number of powers of 2 is at most 21 so this turns the problem to a classic find the number of pairs that sum to a certain value but for 21 values
You need to use something fasters than the NlogN approach since there is already the log of iterating over the powers so one idea is two pointers