The function signature is wrong


  • 7
    A

    The signature of the function takes an integer as input. But the description says it takes an unsigned int as input. The test case also includes 1x10^32.


  • 0
    A

    close, since there is no way for declaring a int is unsigned in Java


  • 0
    K

    declaring the function to take (long n) is allowed ... however OJ testcases still fail.

    In eclipse
    Assert.assertEquals(32, h.hammingWeight(4294967295L));
    passes though.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.