File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
leetcode_py/cli/resources/leetcode/json/problems
leetcode/number_of_1_bits Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
def run_hamming_weight (solution_class : type , n : int ):
2
2
implementation = solution_class ()
3
- return implementation .hammingWeight (n )
3
+ return implementation .hamming_weight (n )
4
4
5
5
6
6
def assert_hamming_weight (result : int , expected : int ) -> bool :
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ class Solution:
2
2
3
3
# Time: O(1) - at most 32 iterations (number of bits in int)
4
4
# Space: O(1) - only using constant extra space
5
- def hammingWeight (self , n : int ) -> int :
5
+ def hamming_weight (self , n : int ) -> int :
6
6
"""
7
7
Count the number of set bits (1s) in the binary representation of n.
8
8
Original file line number Diff line number Diff line change 29
29
"helpers_content" : " " ,
30
30
"helpers_run_name" : " hamming_weight" ,
31
31
"helpers_run_signature" : " (solution_class: type, n: int)" ,
32
- "helpers_run_body" : " implementation = solution_class()\n return implementation.hammingWeight (n)" ,
32
+ "helpers_run_body" : " implementation = solution_class()\n return implementation.hamming_weight (n)" ,
33
33
"helpers_assert_name" : " hamming_weight" ,
34
34
"helpers_assert_signature" : " (result: int, expected: int) -> bool" ,
35
35
"helpers_assert_body" : " assert result == expected\n return True" ,
43
43
"_solution_methods" : {
44
44
"list" : [
45
45
{
46
- "name" : " hammingWeight " ,
46
+ "name" : " hamming_weight " ,
47
47
"signature" : " (self, n: int) -> int" ,
48
- "body" : " # TODO: Implement hammingWeight \n return 0"
48
+ "body" : " # TODO: Implement hamming_weight \n return 0"
49
49
}
50
50
]
51
51
},
You can’t perform that action at this time.
0 commit comments