File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 58
58
| 172 | [ Factoring Trailing Zeroes] ( https://leetcode.com/problems/factorial-trailing-zeroes ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/FactorialTrailingZeros.java ) |
59
59
| 189 | [ Rotate Array] ( https://leetcode.com/problems/rotate-array ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/RotateArray.java ) |
60
60
| 190 | [ Reverse Bits] ( https://leetcode.com/problems/reverse-bits ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ReverseBits.java ) |
61
- | 191 | [ Number of One Bits] ( https://leetcode.com/problems/number-of-1-bits ) | Easy |
61
+ | 191 | [ Number of One Bits] ( https://leetcode.com/problems/number-of-1-bits ) | Easy | [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( ) |
62
62
| 198 | [ House Robber] ( https://leetcode.com/problems/house-robber ) | Easy |
63
63
| 202 | [ Happy Number] ( https://leetcode.com/problems/happy-number ) | Easy |
64
64
| 203 | [ Remove Linked List Elements] ( https://leetcode.com/problems/remove-linked-list-elements ) | Easy |
Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def hammingWeight (self , number : int ) -> int :
3
+ binary = bin (number )
4
+ count = 0
5
+ for index in range (2 , len (binary )):
6
+ if int (binary [index ]) == 1 :
7
+ count += 1
8
+ return count
9
+
You can’t perform that action at this time.
0 commit comments