Problem 2859 · Easy
Count the set bits of each index in binary and add the value at every index whose count equals k.
Open the interactive visualisation