Given a positive integer n, write a function that returns the number of set bits it has (also known as the Hamming weight).
n
Click "Run" or press Ctrl+Enter to execute test cases.