You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ You can also ask for problem solving ideas and discuss in GitHub issues directly
61
61
|167|[Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_167.java) & Python| Easy| Two-Pointer Technique
|278|[First Bad Version](https://leetcode.com/problems/first-bad-version/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search/_278.java) & [Python](https://github.com/guobinhit/myleetcode/blob/master/codes/python/leetcodes/src/main/python/com/hit/basmath/learn/binary_search/_278.py)|Easy| Sorting and Searching
|326|[Power of Three](https://leetcode.com/problems/power-of-three/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/math/_326.java) & Python |Easy| Math
|350|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search/_350.java) & Python |Easy| Array
926
926
|384|[Shuffle an Array](https://leetcode.com/problems/shuffle-an-array/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/design/_384.java) & Python |Medium| Design
927
927
|387|[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_387.java) & Python |Easy| Strings
928
928
|412|[Fizz Buzz](https://leetcode.com/problems/fizz-buzz/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/math/_412.java) & Python |Easy| Math
* Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weight).
7
+
* <p>
8
+
* Example 1:
9
+
* <p>
10
+
* Input: 00000000000000000000000000001011
11
+
* Output: 3
12
+
* Explanation: The input binary string 00000000000000000000000000001011 has a total of three '1' bits.
13
+
* <p>
14
+
* Example 2:
15
+
* <p>
16
+
* Input: 00000000000000000000000010000000
17
+
* Output: 1
18
+
* Explanation: The input binary string 00000000000000000000000010000000 has a total of one '1' bit.
19
+
* <p>
20
+
* Example 3:
21
+
* <p>
22
+
* Input: 11111111111111111111111111111101
23
+
* Output: 31
24
+
* Explanation: The input binary string 11111111111111111111111111111101 has a total of thirty one '1' bits.
25
+
* <p>
26
+
* <p>
27
+
* Note:
28
+
* <p>
29
+
* Note that in some languages such as Java, there is no unsigned integer type. In this case, the input will be given as signed integer type and should not affect your implementation, as the internal binary representation of the integer is the same whether it is signed or unsigned.
30
+
* In Java, the compiler represents the signed integers using 2's complement notation. Therefore, in Example 3 above the input represents the signed integer -3.
31
+
* <p>
32
+
* <p>
33
+
* Follow up:
34
+
* <p>
35
+
* If this function is called many times, how would you optimize it?
0 commit comments