We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The function (standard in G C++) will return the amount of bits set to one (in the binary representation) of the parameter passed (s in this case). So:
__builtin_popcount(1) == 1
__builtin_popcount(2) == 1
__builtin_popcount(3) == 2
__builtin_popcount(4) == 1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Jaggu Playing with Balloons
You are viewing a single comment's thread. Return to all comments →
The function (standard in G C++) will return the amount of bits set to one (in the binary representation) of the parameter passed (s in this case). So:
__builtin_popcount(1) == 1
__builtin_popcount(2) == 1
__builtin_popcount(3) == 2
__builtin_popcount(4) == 1